diff --git a/command_button.gd b/command_button.gd new file mode 100644 index 0000000..d0a6a0a --- /dev/null +++ b/command_button.gd @@ -0,0 +1,8 @@ +extends Button + +func _ready(): + pass + + +func pressed(): + $"..".send_command(text) diff --git a/command_button.tscn b/command_button.tscn new file mode 100644 index 0000000..d638130 --- /dev/null +++ b/command_button.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://command_button.gd" type="Script" id=1] + +[node name="Button" type="Button"] +margin_left = 1418.81 +margin_top = 760.827 +margin_right = 1672.81 +margin_bottom = 780.827 +text = "git commit --allow-empty -m \"emtpy\"" +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} +[connection signal="pressed" from="." to="." method="pressed"] diff --git a/main.gd b/main.gd index 13f20c1..1330fdf 100644 --- a/main.gd +++ b/main.gd @@ -95,10 +95,10 @@ func _process(delta): func read_commit_message(): $CommitMessage.show() $Terminal/Input.editable = false - $CommitMessage.text = game.read_file("/tmp/githydragit/.git/COMMIT_EDITMSG") + $CommitMessage.text = game.read_file($ActiveRepository.path+"/.git/COMMIT_EDITMSG") func save_commit_message(): - game.write_file("/tmp/githydragit/.git/COMMIT_EDITMSG", $CommitMessage.text) + game.write_file($ActiveRepository.path+"/.git/COMMIT_EDITMSG", $CommitMessage.text) print("disconnect") client_connection.disconnect_from_host() $Terminal/Input.editable = true diff --git a/main.tscn b/main.tscn index f192577..7de13f8 100644 --- a/main.tscn +++ b/main.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://terminal.gd" type="Script" id=1] [ext_resource path="res://main.gd" type="Script" id=2] [ext_resource path="res://repository.tscn" type="PackedScene" id=3] +[ext_resource path="res://command_button.tscn" type="PackedScene" id=4] [node name="Main" type="Node2D"] script = ExtResource( 2 ) @@ -12,10 +13,10 @@ z_index = 1 script = ExtResource( 1 ) [node name="Output" type="TextEdit" parent="Terminal"] -margin_left = 1416.1 +margin_left = 1416.0 margin_top = 4.0 -margin_right = 1915.1 -margin_bottom = 1008.0 +margin_right = 1915.0 +margin_bottom = 737.0 readonly = true __meta__ = { "_edit_use_anchors_": false @@ -30,6 +31,22 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="Button" parent="Terminal" instance=ExtResource( 4 )] + +[node name="Button2" parent="Terminal" instance=ExtResource( 4 )] +margin_left = 1417.9 +margin_top = 801.646 +margin_right = 1671.9 +margin_bottom = 821.646 +text = "git switch -c $RANDOM" + +[node name="Button3" parent="Terminal" instance=ExtResource( 4 )] +margin_left = 1417.45 +margin_top = 846.547 +margin_right = 1671.45 +margin_bottom = 866.547 +text = "git checkout HEAD^" + [node name="CommitMessage" type="TextEdit" parent="."] visible = false margin_left = 889.832