Skip to content

Commit

Permalink
Add progress alias
Browse files Browse the repository at this point in the history
  • Loading branch information
miallo committed Jan 15, 2024
1 parent 9e49bac commit c43eee5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ cp "$DOCDIR/another-downstream/"* ".git/another-downstream/docdir/"
# Scripts for aliases
replace CHAPTER_INTERACTIVE_REBASE_FOLLOW "$DOCDIR/skip_to_chapter.sh" > .git/skip_to_chapter.sh
chmod +x .git/skip_to_chapter.sh
replace NUMBER_OF_NUGGITS "$DOCDIR/progress.sh" > .git/progress.sh
chmod +x .git/progress.sh

# # debug origin hooks
# while read -r hook; do
Expand Down
1 change: 1 addition & 0 deletions lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ remove_build_setup_from_config() {
add_player_config() {
git config --local --add alias.redeem-nuggit '!$(git rev-parse --show-toplevel)/.git/redeem.nuggit'
git config --local --add alias.skip-to-nuggit-chapter '!$(git rev-parse --show-toplevel)/.git/skip_to_chapter.sh'
git config --local --add alias.nuggit-progress '!$(git rev-parse --show-toplevel)/.git/progress.sh'
}

# Useage:
Expand Down
9 changes: 6 additions & 3 deletions src/01_init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,19 @@ A: A nuggit is almost like a nugget a small golden piece, but with more git in i
Q: How do I redeem a nuggit?
A: Just run `git redeem-nuggit <name of the nuggit>` - it will show you if you are correct or not. (No, redeem-nuggit is not a builtin git command, but an "alias" in this repository, we'll come to that later...)

Q: Where do I see all my redeemed nuggits and the time when I redeemed them?
A: Just run `git log nuggits` :)
Q: What custom commands are there for nuggits?
A: The commands that will only work in this project are:
- `git redeem-nuggit <name of the nuggit>` - submit a nuggit
- `git nuggit-progress` - get an overview of how many nuggits you already collected
- `git log nuggits` - list all the nuggits you have found

Q: Why you get this folder in this way instead of the usual `git clone <url>`?
A: That is a good question and you will figure out the answer the more you get into the quests (many of which are impossible in a fresh clone).

Q: Can I use my favourite git GUI tool?
A: Well... For a few of the nuggits, yes, but some are well hidden in the stranger parts of git, so this project assumes running git from the command line from the beginning.

Q: I want to learn more about a command - how?
Q: I want to learn more about a git command - how?
A: As a first step, just run `git <command> --help` - otherwise: the internet is your friend.

NOTE: This tutorial uses git hooks extensively for it to work. Because of the way you downloaded this repository they are enabled by default and could run arbitrary code. I promise you they are just here for the benefit of learning git and don't do anything malicious. If it makes you feel better: For testing this tutorial I have a test suite that I am regularly running on my machine that triggers all of them.
Expand Down
3 changes: 3 additions & 0 deletions src/progress.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

echo "You have found $(( "$(git rev-list --count nuggits)" - 1)) of NUMBER_OF_NUGGITS nuggits"

0 comments on commit c43eee5

Please sign in to comment.