Skip to content

Commit 294bd39

Browse files
committed
First couple of git related missions
ported from MKessar and mathaefele's repo at https://github.com/MKessar/GameShell_git This branch is the start of a big port of most of their missions to add to the "standard" gameshell, as an alternative index file. Those missions are not finished but show the kind of work we need to do before that is possible.
1 parent fa175bb commit 294bd39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1525
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
SH_FILES=$(wildcard *.sh)
2+
EXCEPTIONS=
3+
OTHER_FILES=
4+
5+
LANGUAGES=$(wildcard i18n/*.po)
6+
LANGUAGES:=$(filter-out i18n/en.po, $(LANGUAGES))
7+
SH_FILES:=$(filter-out $(EXCEPTIONS), $(SH_FILES))
8+
SORT=
9+
OPTIONS=--indent --no-wrap --no-location
10+
11+
all: i18n/en.po $(LANGUAGES)
12+
13+
add-locations: SORT=--add-location --sort-by-file
14+
add-locations: all
15+
16+
i18n/en.po: i18n/template.pot FORCE
17+
@echo "msgen $@"
18+
@msgen $(OPTIONS) $(SORT) i18n/template.pot --output=$@
19+
@echo "# AUTOMATICALLY GENERATED -- DO NOT EDIT" | cat - $@ > $@~
20+
@mv $@~ $@
21+
22+
$(LANGUAGES):%.po: i18n/template.pot FORCE
23+
@echo "msgmerge $@"
24+
@msgmerge --update $(OPTIONS) $(SORT) $@ i18n/template.pot
25+
26+
i18n/template.pot: $(SH_FILES) $(OTHER_FILES) FORCE
27+
@mkdir -p i18n/
28+
@echo "generating i18n/template.pot"
29+
@xgettext --from-code=UTF-8 --omit-header $(OPTIONS) $(SORT) --join-existing --output i18n/template.pot $(SH_FILES) $(OTHER_FILES)
30+
@echo "done"
31+
32+
new: i18n/template.pot
33+
@read -p "language code: " lang; \
34+
[ -e "./i18n/$$lang.po" ] && echo "file i18n/$$lang.po already exists" && exit; \
35+
echo "file i18n/$$lang.po created"; \
36+
msgcat $(OPTIONS) --output i18n/$$lang.po i18n/template.pot
37+
38+
clean:
39+
rm -f i18n/*~
40+
41+
.PHONY: all clean new FORCE
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# default git config file for GameShell-git missions
2+
3+
[core]
4+
editor = nano
5+
6+
[init]
7+
defaultBranch = main
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env sh
2+
3+
# add CWD in the prompt, as in the third mission from standard GameShell
4+
case "$GSH_SHELL" in
5+
*bash)
6+
export PS1='
7+
\w
8+
[mission $(gsh pcm)] $ '
9+
;;
10+
*zsh)
11+
export PS1='
12+
%~
13+
[mission $(gsh pcm)] $ '
14+
;;
15+
esac
16+
17+
18+
# prevent git from going above $GSH_ROOT when searching for enclosing git repo
19+
export GIT_CEILING_DIRECTORIES=$GSH_ROOT
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# AUTOMATICALLY GENERATED -- DO NOT EDIT
2+
msgid ""
3+
msgstr "Content-Type: text/plain; charset=ASCII\n"
4+
"Content-Transfer-Encoding: 8bit\n"
5+
6+
# path for the text file containing the goal
7+
msgid "$MISSION_DIR/goal/en.txt"
8+
msgstr "$MISSION_DIR/goal/en.txt"
9+
10+
# path for the text file containing the treasure message
11+
msgid "$MISSION_DIR/treasure-msg/en.txt"
12+
msgstr "$MISSION_DIR/treasure-msg/en.txt"
13+
14+
# path for the text file containing the skip message
15+
msgid "$MISSION_DIR/skip/en.txt"
16+
msgstr "$MISSION_DIR/skip/en.txt"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
msgid ""
2+
msgstr "Content-Type: text/plain; charset=UTF-8\n"
3+
"Content-Transfer-Encoding: 8bit\n"
4+
5+
# path for the text file containing the goal
6+
msgid "$MISSION_DIR/goal/en.txt"
7+
msgstr ""
8+
9+
# path for the text file containing the treasure message
10+
msgid "$MISSION_DIR/treasure-msg/en.txt"
11+
msgstr ""
12+
13+
# path for the text file containing the skip message
14+
msgid "$MISSION_DIR/skip/en.txt"
15+
msgstr ""
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
msgid ""
2+
msgstr "Content-Type: text/plain; charset=UTF-8\n"
3+
"Content-Transfer-Encoding: 8bit\n"
4+
5+
# path for the text file containing the goal
6+
msgid "$MISSION_DIR/goal/en.txt"
7+
msgstr ""
8+
9+
# path for the text file containing the treasure message
10+
msgid "$MISSION_DIR/treasure-msg/en.txt"
11+
msgstr ""
12+
13+
# path for the text file containing the skip message
14+
msgid "$MISSION_DIR/skip/en.txt"
15+
msgstr ""

missions/contrib/TODO.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
- [x] should we use `git switch` or `git checkout` => `git switch`
3+
- [ ] should we use `HEAD` or `@`, or both
4+
- [ ] create one or two "big" existing repositories (with several branches and commits) for some of the advanced missions
5+
6+
- [ ] discuss use of "git vocabulary" (directory vs repository, tracked vs untracked, index area, etc) vs "lore vocabulary"
7+
8+
- [ ] check if I can deal with dependencies (eg, nano) from inside a dummy mission (00_git_shared)
9+
10+
- [ ] add some git specific aliases as `treasure.sh` files, for example
11+
- `gs => git status`
12+
- `gl => git log --oneline`
13+
- `gll => git log --stat`
14+
- `gg => git log --all --decorate --oneline --graph`
15+
NOTE: I'm not sure that there is any advantage using "git aliases" (git
16+
config --global alias.ALIAS ...)
17+
18+

missions/contrib/git.idx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
!00_git_shared
2+
git_basics/01_init
3+
git_basics/02_create_file
4+
git_basics/03_add
5+
git_basics/00_config
6+
git_basics/04_commit
7+
../FINAL_MISSION
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
SH_FILES=$(wildcard *.sh)
2+
EXCEPTIONS=
3+
OTHER_FILES=
4+
5+
LANGUAGES=$(wildcard i18n/*.po)
6+
LANGUAGES:=$(filter-out i18n/en.po, $(LANGUAGES))
7+
SH_FILES:=$(filter-out $(EXCEPTIONS), $(SH_FILES))
8+
SORT=
9+
OPTIONS=--indent --no-wrap --no-location
10+
11+
all: i18n/en.po $(LANGUAGES)
12+
13+
add-locations: SORT=--add-location --sort-by-file
14+
add-locations: all
15+
16+
i18n/en.po: i18n/template.pot FORCE
17+
@echo "msgen $@"
18+
@msgen $(OPTIONS) $(SORT) i18n/template.pot --output=$@
19+
@echo "# AUTOMATICALLY GENERATED -- DO NOT EDIT" | cat - $@ > $@~
20+
@mv $@~ $@
21+
22+
$(LANGUAGES):%.po: i18n/template.pot FORCE
23+
@echo "msgmerge $@"
24+
@msgmerge --update $(OPTIONS) $(SORT) $@ i18n/template.pot
25+
26+
i18n/template.pot: $(SH_FILES) $(OTHER_FILES) FORCE
27+
@mkdir -p i18n/
28+
@echo "generating i18n/template.pot"
29+
@xgettext --from-code=UTF-8 --omit-header $(OPTIONS) $(SORT) --join-existing --output i18n/template.pot $(SH_FILES) $(OTHER_FILES)
30+
@echo "done"
31+
32+
new: i18n/template.pot
33+
@read -p "language code: " lang; \
34+
[ -e "./i18n/$$lang.po" ] && echo "file i18n/$$lang.po already exists" && exit; \
35+
echo "file i18n/$$lang.po created"; \
36+
msgcat $(OPTIONS) --output i18n/$$lang.po i18n/template.pot
37+
38+
clean:
39+
rm -f i18n/*~
40+
41+
.PHONY: all clean new FORCE
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
3+
git config --global user.name "auto user.name Gameshell-Git"
4+
git config --global user.email auto@user.email.gameshell.git
5+
gsh check

0 commit comments

Comments
 (0)