mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-13 19:04:54 +01:00
Hide read/write messages behind game.debug flag
This commit is contained in:
parent
f09abe36e9
commit
3460e37d82
3 changed files with 9 additions and 4 deletions
7
game.gd
7
game.gd
|
@ -2,13 +2,15 @@ extends Node
|
|||
|
||||
var tmp_prefix = "/tmp/"
|
||||
var global_shell
|
||||
var debug = false
|
||||
|
||||
func _ready():
|
||||
global_shell = Shell.new()
|
||||
global_shell.cd(tmp_prefix)
|
||||
|
||||
func read_file(path):
|
||||
print ("reading " + path)
|
||||
if debug:
|
||||
print("reading " + path)
|
||||
var file = File.new()
|
||||
file.open(path, File.READ)
|
||||
var content = file.get_as_text()
|
||||
|
@ -16,7 +18,8 @@ func read_file(path):
|
|||
return content
|
||||
|
||||
func write_file(path, content):
|
||||
print ("writing " + path)
|
||||
if debug:
|
||||
print("writing " + path)
|
||||
var file = File.new()
|
||||
file.open(path, File.WRITE)
|
||||
file.store_string(content)
|
||||
|
|
4
main.gd
4
main.gd
|
@ -87,7 +87,9 @@ func construct_repo(script, path):
|
|||
shell.run("mkdir " + path)
|
||||
shell.cd(path)
|
||||
shell.run("git init")
|
||||
print(shell.run("source "+script_path))
|
||||
var output = shell.run("source "+script_path)
|
||||
if game.debug:
|
||||
print(output)
|
||||
|
||||
func _process(delta):
|
||||
if server.is_connection_available():
|
||||
|
|
2
shell.gd
2
shell.gd
|
@ -17,7 +17,7 @@ func cd(dir):
|
|||
# Run a shell command given as a string. Run this if you're interested in the
|
||||
# output of the command.
|
||||
func run(command):
|
||||
var debug = true
|
||||
var debug = false
|
||||
|
||||
if debug:
|
||||
print("$ %s" % command)
|
||||
|
|
Loading…
Reference in a new issue