Skip to content

Commit df10ea9

Browse files
committed
justfile: Make get-started slightly more ergonomic
Now `just get-started` will check whether `~/.local/bin` is in $PATH and ask the user to add it if it isn't. In addition, some file management operations have been quieted down. Signed-off-by: Rune Morling <[email protected]>
1 parent b6ea743 commit df10ea9

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

justfile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ default: moss
44
root-dir := justfile_directory()
55
build-mode := env_var_or_default("MODE", "onboarding")
66
# Keep it simple for now and make installs user-local
7-
xdg-data-home := "$HOME/.local/share"
8-
xdg-bin-home := "$HOME/.local/bin"
7+
home := env_var("HOME")
8+
# Hacky -- should really check for the XDG_*_DIR env vars...
9+
xdg-data-home := home + "/.local/share"
10+
xdg-bin-home := home + "/.local/bin"
11+
# Read '=~' as 'contains' in the regexp sense
12+
xdg-bin-home-in-path := if env_var("PATH") =~ xdg-bin-home { 'is already in \$PATH. Excellent.' } else { 'is not yet in \$PATH. Please add it.' }
913

1014
[private]
1115
help:
@@ -25,18 +29,21 @@ moss: (build "moss")
2529
get-started: (build "boulder") (build "moss")
2630
@echo ""
2731
@echo "Installing boulder and moss to {{xdg-bin-home}}/ ..."
28-
mkdir -pv "{{xdg-bin-home}}/"
29-
cp "{{root-dir}}/target/{{build-mode}}"/{boulder,moss} "{{xdg-bin-home}}/"
30-
rm -rf "{{xdg-data-home}}/boulder"
31-
mkdir -pv "{{xdg-data-home}}/boulder/"
32-
cp -R "{{root-dir}}/boulder/data"/* "{{xdg-data-home}}/boulder/"
32+
@mkdir -p "{{xdg-bin-home}}/"
33+
@cp "{{root-dir}}/target/{{build-mode}}"/{boulder,moss} "{{xdg-bin-home}}/"
34+
@rm -rf "{{xdg-data-home}}/boulder"
35+
@mkdir -p "{{xdg-data-home}}/boulder/"
36+
@cp -R "{{root-dir}}/boulder/data"/* "{{xdg-data-home}}/boulder/"
3337
@echo ""
3438
@echo "Listing installed files..."
35-
ls -hlF "{{xdg-bin-home}}"/{boulder,moss} "{{xdg-data-home}}/boulder"
39+
@ls -hlF "{{xdg-bin-home}}"/{boulder,moss} "{{xdg-data-home}}/boulder"
3640
@echo ""
37-
@echo "Checking the system path to boulder and moss executables:"
38-
command -v boulder
39-
command -v moss
41+
@echo "Checking that {{xdg-bin-home}} is in \$PATH..."
42+
@echo "... {{xdg-bin-home}} {{xdg-bin-home-in-path}}"
43+
@echo ""
44+
@echo "Checking the location of boulder and moss executables when executed in a shell:"
45+
@command -v boulder
46+
@command -v moss
4047
@echo ""
4148
@echo "Done."
4249
@echo ""

0 commit comments

Comments
 (0)