oh-my-git/scenes/sandbox.gd

35 lines
953 B
GDScript3
Raw Normal View History

extends Control
func _ready():
var path = null
var args = helpers.parse_args()
if args.has("sandbox"):
if args["sandbox"] is String:
if args["sandbox"] == ".":
args["sandbox"] = OS.get_environment("PWD")
2023-09-06 16:04:23 +02:00
if DirAccess.open(args["sandbox"]):
path = args["sandbox"]
else:
2023-09-06 16:04:23 +02:00
helpers.crash("DirAccess %s does not exist" % args["sandbox"])
if path == null:
2020-10-26 19:56:52 +01:00
path = game.tmp_prefix+"/repos/sandbox/"
2023-09-07 14:45:52 +02:00
await helpers.careful_delete(path)
2023-09-07 14:45:52 +02:00
await game.global_shell.run("mkdir '%s'" % path)
await game.global_shell.cd(path)
await game.global_shell.run("git init")
await game.global_shell.run("git symbolic-ref HEAD refs/heads/main")
$Columns/Repository.path = path
2023-09-06 16:04:23 +02:00
#ToDo strech modes
#get_tree().set_screen_stretch(SceneTree.STRETCH_MODE_2D, SceneTree.STRETCH_ASPECT_KEEP, Vector2(1920, 1080), 1.5)
$Columns/Terminal.repository = $Columns/Repository
func update_repo():
$Columns/Repository.update_everything()