diff --git a/build.sh b/build.sh index ffb902d..3b22458 100755 --- a/build.sh +++ b/build.sh @@ -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 diff --git a/lib.sh b/lib.sh index 5ca715f..c3929bc 100644 --- a/lib.sh +++ b/lib.sh @@ -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: diff --git a/src/01_init/README.md b/src/01_init/README.md index e0627f3..879a9d8 100644 --- a/src/01_init/README.md +++ b/src/01_init/README.md @@ -14,8 +14,11 @@ 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 ` - 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 ` - 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 `? 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). @@ -23,7 +26,7 @@ A: That is a good question and you will figure out the answer the more you get i 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 --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. diff --git a/src/progress.sh b/src/progress.sh new file mode 100755 index 0000000..bd5e534 --- /dev/null +++ b/src/progress.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +echo "You have found $(( "$(git rev-list --count nuggits)" - 1)) of NUMBER_OF_NUGGITS nuggits"