Use Perl for the fake-editor :D

This commit is contained in:
Sebastian Morr 2020-09-09 18:32:57 +02:00
parent 4099030fcd
commit 75679c8bb1
5 changed files with 29 additions and 13 deletions

View File

@ -40,7 +40,7 @@ func _tmp_prefix():
elif os == "Windows": elif os == "Windows":
# For some reason, this command outputs a space in the end? We remove it. # For some reason, this command outputs a space in the end? We remove it.
# Also, Godot's default is to use forward slashes for everything. # Also, Godot's default is to use forward slashes for everything.
return exec("echo", ["%TEMP%"]).replacen("\\", "/").replace(" \n", "") return exec("echo", ["%TEMP%"]).replacen("\\", "/").replace(" \n", "/")
else: else:
push_error("Unsupported OS") push_error("Unsupported OS")
get_tree().quit() get_tree().quit()

View File

@ -101,11 +101,13 @@ func _process(_delta):
func read_commit_message(): func read_commit_message():
$CommitMessage.show() $CommitMessage.show()
input.editable = false input.editable = false
$CommitMessage.text = game.read_file(active_repository.path+"/.git/COMMIT_EDITMSG") var fixme_path = game.tmp_prefix+"/active"
$CommitMessage.text = game.read_file(fixme_path+"/.git/COMMIT_EDITMSG")
$CommitMessage.grab_focus() $CommitMessage.grab_focus()
func save_commit_message(): func save_commit_message():
game.write_file(active_repository.path+"/.git/COMMIT_EDITMSG", $CommitMessage.text) var fixme_path = game.tmp_prefix+"/active"
game.write_file(fixme_path+"/.git/COMMIT_EDITMSG", $CommitMessage.text)
print("disconnect") print("disconnect")
client_connection.disconnect_from_host() client_connection.disconnect_from_host()
input.editable = true input.editable = true

View File

@ -1,3 +1,11 @@
#!/bin/sh #!/usr/bin/env perl
nc localhost 1234 use IO::Socket;
$socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
PeerPort => 1234,
Proto => "tcp",
Type => SOCK_STREAM);
my $reply;
$socket->read($reply, 1000);

View File

@ -21,6 +21,10 @@ func run(command):
var env = {} var env = {}
env["EDITOR"] = game.fake_editor env["EDITOR"] = game.fake_editor
env["GIT_AUTHOR_NAME"] = "You"
env["GIT_COMMITTER_NAME"] = "You"
env["GIT_AUTHOR_EMAIL"] = "you@example.com"
env["GIT_COMMITTER_EMAIL"] = "you@example.com"
var hacky_command = "" var hacky_command = ""
for variable in env: for variable in env:

View File

@ -36,24 +36,26 @@ __meta__ = {
[node name="Output" type="RichTextLabel" parent="Control"] [node name="Output" type="RichTextLabel" parent="Control"]
margin_right = 1920.0 margin_right = 1920.0
margin_bottom = 1039.0 margin_bottom = 1019.0
size_flags_vertical = 3 size_flags_vertical = 3
custom_styles/normal = SubResource( 1 ) custom_styles/normal = SubResource( 1 )
custom_fonts/normal_font = ExtResource( 1 ) custom_fonts/normal_font = ExtResource( 1 )
scroll_following = true scroll_following = true
[node name="Button" parent="Control" instance=ExtResource( 4 )] [node name="Button" parent="Control" instance=ExtResource( 4 )]
visible = false margin_left = 0.0
margin_top = 852.0 margin_top = 1019.0
margin_right = 700.0 margin_right = 1920.0
margin_bottom = 905.0 margin_bottom = 1039.0
text = "git commit --allow-empty"
align = 0 align = 0
[node name="Button2" parent="Control" instance=ExtResource( 4 )] [node name="Button2" parent="Control" instance=ExtResource( 4 )]
visible = false visible = false
margin_top = 905.0 margin_left = 0.0
margin_right = 700.0 margin_top = 1019.0
margin_bottom = 958.0 margin_right = 1920.0
margin_bottom = 1039.0
text = "git switch -c $RANDOM" text = "git switch -c $RANDOM"
align = 0 align = 0