mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-13 19:04:54 +01:00
Add cli hints to the first three levels
This commit is contained in:
parent
437cbb7a37
commit
7ecc55a3fb
10 changed files with 75 additions and 15 deletions
|
@ -7,6 +7,10 @@ You were invited to two parties! At one of them, your favorite band is playing -
|
||||||
|
|
||||||
To make it easier to tell which timeline is which, you can create time portals! (We call these "branches".)
|
To make it easier to tell which timeline is which, you can create time portals! (We call these "branches".)
|
||||||
|
|
||||||
|
[cli]
|
||||||
|
|
||||||
|
Branches also make it really easy to travel between different places using the command line! As soon as you have a branch called "birthday", you can type `git checkout birthday` to travel to it!
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
echo "You wrap the birthday present, and grab your concert ticket." > you
|
echo "You wrap the birthday present, and grab your concert ticket." > you
|
||||||
|
|
|
@ -9,6 +9,12 @@ The grey panel below shows your current environment - click on an object to insp
|
||||||
|
|
||||||
Can you find out what happened here? Then, while on the latest commit, edit the files to fix the problem, and make a new commit!
|
Can you find out what happened here? Then, while on the latest commit, edit the files to fix the problem, and make a new commit!
|
||||||
|
|
||||||
|
[cli]
|
||||||
|
|
||||||
|
To checkout a specific commit, type `git checkout`, then a space, and then right click on the commit you want!
|
||||||
|
|
||||||
|
This will insert the commit's unique identifier!
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
echo "This piggy bank belongs to the big sister.
|
echo "This piggy bank belongs to the big sister.
|
||||||
|
|
|
@ -7,6 +7,18 @@ Did you know that creating parallel timelines is perfectly legal and safe? It's
|
||||||
|
|
||||||
Can you find out when things went wrong in this zoo, and create a parallel universe where everyone is happy?
|
Can you find out when things went wrong in this zoo, and create a parallel universe where everyone is happy?
|
||||||
|
|
||||||
|
[cli]
|
||||||
|
|
||||||
|
The blue animal represents a concept known as the "HEAD pointer" in Git: It shows you which commit is the current one.
|
||||||
|
|
||||||
|
Here's a cool trick to go to the previous commit:
|
||||||
|
|
||||||
|
git checkout HEAD^
|
||||||
|
|
||||||
|
You can also go back two commits by typing, for example:
|
||||||
|
|
||||||
|
git checkout HEAD~2
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
mkdir cage
|
mkdir cage
|
||||||
|
|
|
@ -9,6 +9,12 @@ First, you can directly travel to the commit, like we've done it before.
|
||||||
|
|
||||||
And second, you can travel to the branch label. In this case, when you make a new commit, the branch will grow with you, and still point at the end of the timeline!
|
And second, you can travel to the branch label. In this case, when you make a new commit, the branch will grow with you, and still point at the end of the timeline!
|
||||||
|
|
||||||
|
[cli]
|
||||||
|
|
||||||
|
To travel to a branch, type `git checkout name_of_the_branch`.
|
||||||
|
|
||||||
|
And to travel to the last commit, type `git checkout --detach name_of_the_branch`.
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
echo "You wrap the birthday present, and grab your concert ticket." > you
|
echo "You wrap the birthday present, and grab your concert ticket." > you
|
||||||
|
|
|
@ -8,6 +8,12 @@ Full of excitement you open the door just to find... spider webs! Spider webs ev
|
||||||
|
|
||||||
Remove all the spider webs you can find with the remove card!
|
Remove all the spider webs you can find with the remove card!
|
||||||
|
|
||||||
|
[cli]
|
||||||
|
|
||||||
|
On the command line, you can easily delete all files ending in -web using this command:
|
||||||
|
|
||||||
|
rm *web
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
echo A tiny spider web is next to your window. > tiny_web
|
echo A tiny spider web is next to your window. > tiny_web
|
||||||
|
|
|
@ -9,6 +9,12 @@ Here, let's practice this!
|
||||||
|
|
||||||
(Your teacher pours some water into a glass.)
|
(Your teacher pours some water into a glass.)
|
||||||
|
|
||||||
|
[cli]
|
||||||
|
|
||||||
|
Again, instead of using the card, you can also type the commands which are printed on it into the black terminal below!
|
||||||
|
|
||||||
|
This is totally optional! But this will be a super useful skill in the real world - and it will give you a sparkling golden badge! :)
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
echo "The glass is full of water." > glass
|
echo "The glass is full of water." > glass
|
||||||
|
|
|
@ -5,10 +5,13 @@ cards = init
|
||||||
|
|
||||||
You've been accepted to time travel school! Yay! It's your first day! Your teacher explains:
|
You've been accepted to time travel school! Yay! It's your first day! Your teacher explains:
|
||||||
|
|
||||||
"To do anything with a time machine, you first need to initialize it! Go ahead, try it!"
|
"To do anything with a time machine, you first need to initialize it!"
|
||||||
|
|
||||||
|
Drag the blue card up to play it!
|
||||||
|
|
||||||
[cli]
|
[cli]
|
||||||
Instead of playing a card, you can slo type 'git init' directly into your terminal!
|
|
||||||
|
Instead of using the card, you can also type `git init` into the black box below, and press the enter key!
|
||||||
|
|
||||||
[setup]
|
[setup]
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
title = Working together
|
title = Working together
|
||||||
cards = clone checkout commit-auto pull push
|
cards = clone commit-auto pull push
|
||||||
|
|
||||||
[description]
|
[description]
|
||||||
|
|
||||||
Let's add your name to our list of students!
|
Let's add your name to our list of students! I already have this list my time machine - let's work together!
|
||||||
|
|
||||||
I already have this list my time machine - let's work together!
|
|
||||||
|
|
||||||
Drag the "clone" card to my name to make your own copy of my timeline!
|
Drag the "clone" card to my name to make your own copy of my timeline!
|
||||||
|
|
||||||
|
[cli]
|
||||||
|
|
||||||
|
To clone the teacher's repo via the command line, you need this command:
|
||||||
|
|
||||||
|
git clone ../teacher .
|
||||||
|
|
||||||
|
(Don't forget the dot at the end!)
|
||||||
|
|
||||||
[congrats]
|
[congrats]
|
||||||
|
|
||||||
Welcome to time travel school! :) I'll see you for your first class tomorrow!
|
Welcome to time travel school! :) I'll see you for your first class tomorrow!
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
[ext_resource path="res://images/cli-badge.svg" type="Texture" id=1]
|
[ext_resource path="res://images/cli-badge.svg" type="Texture" id=1]
|
||||||
[ext_resource path="res://scenes/cli_badge.gd" type="Script" id=2]
|
[ext_resource path="res://scenes/cli_badge.gd" type="Script" id=2]
|
||||||
|
|
||||||
[sub_resource type="Curve" id=2]
|
[sub_resource type="Curve" id=1]
|
||||||
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
_data = [ Vector2( 0, 1 ), 0.0, 0.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
|
||||||
|
|
||||||
[sub_resource type="CurveTexture" id=3]
|
[sub_resource type="CurveTexture" id=2]
|
||||||
curve = SubResource( 2 )
|
curve = SubResource( 1 )
|
||||||
|
|
||||||
[sub_resource type="ParticlesMaterial" id=1]
|
[sub_resource type="ParticlesMaterial" id=3]
|
||||||
emission_shape = 2
|
emission_shape = 2
|
||||||
emission_box_extents = Vector3( 20, 20, 1 )
|
emission_box_extents = Vector3( 20, 20, 1 )
|
||||||
flag_disable_z = true
|
flag_disable_z = true
|
||||||
|
@ -20,7 +20,7 @@ initial_velocity_random = 0.47
|
||||||
orbit_velocity = 0.0
|
orbit_velocity = 0.0
|
||||||
orbit_velocity_random = 0.0
|
orbit_velocity_random = 0.0
|
||||||
scale = 7.25
|
scale = 7.25
|
||||||
scale_curve = SubResource( 3 )
|
scale_curve = SubResource( 2 )
|
||||||
color = Color( 0.913725, 0.913725, 0.447059, 1 )
|
color = Color( 0.913725, 0.913725, 0.447059, 1 )
|
||||||
|
|
||||||
[node name="CLIBadge" type="TextureRect"]
|
[node name="CLIBadge" type="TextureRect"]
|
||||||
|
@ -42,4 +42,4 @@ position = Vector2( 21.7701, 14.5133 )
|
||||||
z_index = 1
|
z_index = 1
|
||||||
amount = 3
|
amount = 3
|
||||||
randomness = 0.34
|
randomness = 0.34
|
||||||
process_material = SubResource( 1 )
|
process_material = SubResource( 3 )
|
||||||
|
|
|
@ -22,14 +22,25 @@ func load(path):
|
||||||
|
|
||||||
title = config.get("title", slug)
|
title = config.get("title", slug)
|
||||||
description = config.get("description", "(no description)")
|
description = config.get("description", "(no description)")
|
||||||
|
|
||||||
# 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]", true)
|
description = monospace_regex.sub(description, "\n [code][color=#e1e160]$1[/color][/code]", true)
|
||||||
description = description.split("---")
|
description = description.split("---")
|
||||||
|
|
||||||
var cli_hints = "\n\n[color=#787878]"+config.get("cli", "")+"[/color]"
|
var cli_hints = config.get("cli", "")
|
||||||
description[0] = description[0] + cli_hints
|
# Also do this substitution in the CLI hints.
|
||||||
|
cli_hints = monospace_regex.sub(cli_hints, "\n [code][color=#bbbb5d]$1[/color][/code]", true)
|
||||||
|
|
||||||
|
# Also replace `code` with [code] tags.
|
||||||
|
var monospace_inline_regex = RegEx.new()
|
||||||
|
monospace_inline_regex.compile("`([^`]+)`")
|
||||||
|
description[0] = monospace_inline_regex.sub(description[0], "[code][color=#e1e160]$1[/color][/code]")
|
||||||
|
cli_hints = monospace_inline_regex.sub(cli_hints, "[code][color=#bbbb5d]$1[/color][/code]", true)
|
||||||
|
|
||||||
|
if cli_hints != "":
|
||||||
|
description[0] = description[0] + "\n\n[color=#787878]"+cli_hints+"[/color]"
|
||||||
|
|
||||||
congrats = config.get("congrats", "Good job, you solved the level!\n\nFeel free to try a few more things or click 'Next level'.")
|
congrats = config.get("congrats", "Good job, you solved the level!\n\nFeel free to try a few more things or click 'Next level'.")
|
||||||
cards = Array(config.get("cards", "").split(" "))
|
cards = Array(config.get("cards", "").split(" "))
|
||||||
|
|
Loading…
Reference in a new issue