mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-22 16:20:19 +01:00
Fix opening things in file browser, fix [code] highlighting
This commit is contained in:
parent
f3ff5c5147
commit
8c4c4feeef
12 changed files with 29 additions and 100 deletions
5
level.gd
5
level.gd
|
@ -66,8 +66,9 @@ func load(path):
|
||||||
|
|
||||||
# Surround all lines indented with four spaces with [code] tags.
|
# Surround all lines indented with four spaces with [code] tags.
|
||||||
var monospace_regex = RegEx.new()
|
var monospace_regex = RegEx.new()
|
||||||
monospace_regex.compile("\n (.*)\n")
|
monospace_regex.compile("\\n ([^\\n]*)")
|
||||||
description = monospace_regex.sub(description, "\n [code]$1[/code]\n", true)
|
description = monospace_regex.sub(description, "\n [code]$1[/code]", true)
|
||||||
|
print(description)
|
||||||
|
|
||||||
func construct():
|
func construct():
|
||||||
for r in repos:
|
for r in repos:
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
title = "fu"
|
|
||||||
|
|
||||||
[description]
|
|
||||||
|
|
||||||
So you've been working on a project for a while, and decide you want to put it in a Git repository.
|
|
||||||
|
|
||||||
Here's how to do it! First, you initialize a new Git repository in your current directory:
|
|
||||||
|
|
||||||
git init
|
|
||||||
|
|
||||||
Then say that you want to record the current state of all files:
|
|
||||||
|
|
||||||
git add .
|
|
||||||
|
|
||||||
And then you make a commit, which gives the current state a description, a date, and your name:
|
|
||||||
|
|
||||||
git commit
|
|
||||||
|
|
||||||
[setup]
|
|
||||||
|
|
||||||
mkdir recipes
|
|
||||||
echo -e "blueberries\nflour" > recipes/blueberry_cake.txt
|
|
||||||
echo -e "water\ncarrots" > recipes/carrot soup.txt
|
|
||||||
echo "Very good recipes!" > README.md
|
|
||||||
|
|
||||||
[win]
|
|
||||||
|
|
||||||
test "$(git rev-parse HEAD^{tree})" = 1e02e3151284d0e22cd9b07ca5c5dbae2f3cb521
|
|
|
@ -1,32 +0,0 @@
|
||||||
title = A pull and a conflict
|
|
||||||
author = blinry
|
|
||||||
|
|
||||||
[description]
|
|
||||||
|
|
||||||
You want to push your new commits to the server, but someone has already pushed their own changes.
|
|
||||||
|
|
||||||
In this situation, you need to pull first! Try that here - you'll have to resolve a merge conflict. Push your changes afterwards.
|
|
||||||
|
|
||||||
[congrats]
|
|
||||||
|
|
||||||
Good job! Here's some additional info: banana!
|
|
||||||
|
|
||||||
[setup yours]
|
|
||||||
|
|
||||||
echo fu > file
|
|
||||||
git add .
|
|
||||||
git commit -m "Initial commit"
|
|
||||||
git push
|
|
||||||
|
|
||||||
echo fi > file
|
|
||||||
git commit -a -m "Fi is good"
|
|
||||||
|
|
||||||
[setup origin]
|
|
||||||
|
|
||||||
echo fa > file
|
|
||||||
git add .
|
|
||||||
git commit -a -m "Fa is good"
|
|
||||||
|
|
||||||
[win origin]
|
|
||||||
|
|
||||||
test "$(git rev-parse HEAD^1^)" = "$(git rev-parse HEAD^2^)"
|
|
|
@ -1,20 +0,0 @@
|
||||||
description = Rebase all branches on top of the main branch, so that the commits are in alphabetical order, and then point the main branch to the top commit.
|
|
||||||
|
|
||||||
[setup]
|
|
||||||
|
|
||||||
git commit --allow-empty -m A
|
|
||||||
git commit --allow-empty -m B
|
|
||||||
git commit --allow-empty -m C
|
|
||||||
|
|
||||||
git switch -c side1 main~1
|
|
||||||
git commit --allow-empty -m D
|
|
||||||
git commit --allow-empty -m E
|
|
||||||
|
|
||||||
git switch -c side2 main~2
|
|
||||||
git commit --allow-empty -m F
|
|
||||||
|
|
||||||
git checkout main
|
|
||||||
|
|
||||||
[win]
|
|
||||||
|
|
||||||
diff <(git log --pretty=%s main) <(echo -e "F\nE\nD\nC\nB\nA")
|
|
|
@ -1,8 +0,0 @@
|
||||||
[setup local]
|
|
||||||
|
|
||||||
git commit --allow-empty -m "1"
|
|
||||||
git commit --allow-empty -m "2"
|
|
||||||
git commit --allow-empty -m "3"
|
|
||||||
git push
|
|
||||||
|
|
||||||
[setup origin]
|
|
|
@ -1 +1,3 @@
|
||||||
sandbox
|
motivation
|
||||||
|
setup
|
||||||
|
restore
|
||||||
|
|
8
main.gd
8
main.gd
|
@ -26,21 +26,21 @@ func _ready():
|
||||||
helpers.crash("Could not change to sandbox scene")
|
helpers.crash("Could not change to sandbox scene")
|
||||||
return
|
return
|
||||||
|
|
||||||
current_chapter = 0
|
current_chapter = 2
|
||||||
current_level = 0
|
current_level = 0
|
||||||
|
|
||||||
# Initialize level select.
|
# Initialize level select.
|
||||||
level_select.connect("item_selected", self, "load_level")
|
level_select.connect("item_selected", self, "load_level")
|
||||||
repopulate_levels()
|
repopulate_levels()
|
||||||
level_select.select(0)
|
level_select.select(current_level)
|
||||||
|
|
||||||
# Initialize chapter select.
|
# Initialize chapter select.
|
||||||
chapter_select.connect("item_selected", self, "load_chapter")
|
chapter_select.connect("item_selected", self, "load_chapter")
|
||||||
repopulate_chapters()
|
repopulate_chapters()
|
||||||
chapter_select.select(0)
|
chapter_select.select(current_chapter)
|
||||||
|
|
||||||
# Load first chapter.
|
# Load first chapter.
|
||||||
load_chapter(0)
|
load_chapter(current_chapter)
|
||||||
input.grab_focus()
|
input.grab_focus()
|
||||||
|
|
||||||
func load_chapter(id):
|
func load_chapter(id):
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
use IO::Socket;
|
use IO::Socket;
|
||||||
|
use File::Spec;
|
||||||
|
|
||||||
$socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
|
$socket = IO::Socket::INET->new(PeerAddr => "127.0.0.1",
|
||||||
PeerPort => 1234,
|
PeerPort => 1234,
|
||||||
Proto => "tcp",
|
Proto => "tcp",
|
||||||
Type => SOCK_STREAM);
|
Type => SOCK_STREAM);
|
||||||
|
|
||||||
# Send the length of the first argument as a byte.
|
my $absolute_path = File::Spec->rel2abs($ARGV[0]);
|
||||||
$socket->send(chr(length($ARGV[0])));
|
|
||||||
# Send the first argument as a string.
|
|
||||||
$socket->send($ARGV[0]);
|
|
||||||
|
|
||||||
|
# Send the length of string as a byte.
|
||||||
|
$socket->send(chr(length($absolute_path)));
|
||||||
|
# Send the first argument as a string.
|
||||||
|
$socket->send($absolute_path);
|
||||||
|
|
|
@ -208,3 +208,6 @@ func _completion_selected():
|
||||||
#completions.hide()
|
#completions.hide()
|
||||||
input.grab_focus()
|
input.grab_focus()
|
||||||
input.caret_position = input.text.length()
|
input.caret_position = input.text.length()
|
||||||
|
|
||||||
|
func editor_saved():
|
||||||
|
emit_signal("command_done")
|
||||||
|
|
|
@ -131,4 +131,5 @@ __meta__ = {
|
||||||
[connection signal="text_changed" from="Rows/InputLine/Input" to="." method="_input_changed"]
|
[connection signal="text_changed" from="Rows/InputLine/Input" to="." method="_input_changed"]
|
||||||
[connection signal="text_entered" from="Rows/InputLine/Input" to="." method="send_command"]
|
[connection signal="text_entered" from="Rows/InputLine/Input" to="." method="send_command"]
|
||||||
[connection signal="pressed" from="ClearButton" to="." method="clear"]
|
[connection signal="pressed" from="ClearButton" to="." method="clear"]
|
||||||
|
[connection signal="saved" from="TextEditor" to="." method="editor_saved"]
|
||||||
[connection signal="data_received" from="TCPServer" to="." method="receive_output"]
|
[connection signal="data_received" from="TCPServer" to="." method="receive_output"]
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
extends TextEdit
|
extends TextEdit
|
||||||
|
|
||||||
|
signal saved
|
||||||
|
|
||||||
var path
|
var path
|
||||||
|
|
||||||
var _server
|
var _server
|
||||||
|
@ -30,7 +32,13 @@ func open(filename):
|
||||||
|
|
||||||
func save():
|
func save():
|
||||||
var fixme_path = game.tmp_prefix_outside+"repos/"
|
var fixme_path = game.tmp_prefix_outside+"repos/"
|
||||||
|
|
||||||
|
# Add a newline to the end of the file if there is none.
|
||||||
|
if text.length() > 0 and text.substr(text.length()-1, 1) != "\n":
|
||||||
|
text += "\n"
|
||||||
|
|
||||||
helpers.write_file(fixme_path+path, text)
|
helpers.write_file(fixme_path+path, text)
|
||||||
|
emit_signal("saved")
|
||||||
close()
|
close()
|
||||||
|
|
||||||
func close():
|
func close():
|
||||||
|
|
Loading…
Reference in a new issue