mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-22 16:20:19 +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
3
game.gd
3
game.gd
|
@ -2,12 +2,14 @@ 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):
|
||||
if debug:
|
||||
print("reading " + path)
|
||||
var file = File.new()
|
||||
file.open(path, File.READ)
|
||||
|
@ -16,6 +18,7 @@ func read_file(path):
|
|||
return content
|
||||
|
||||
func write_file(path, content):
|
||||
if debug:
|
||||
print("writing " + path)
|
||||
var file = File.new()
|
||||
file.open(path, File.WRITE)
|
||||
|
|
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