Flatten Justfile commands
This commit is contained in:
59
Justfile
59
Justfile
@@ -1,8 +1,59 @@
|
||||
set shell := ["bash", "-cu"]
|
||||
|
||||
mod bin "Commands/Bin"
|
||||
mod lang "Commands/Lang"
|
||||
mod setup "Commands/Setup"
|
||||
project_root := justfile_directory()
|
||||
scripts_dir := project_root + "/Scripts"
|
||||
bin_script_dir := scripts_dir + "/bin"
|
||||
|
||||
help:
|
||||
just --list --list-submodules
|
||||
@printf '%s\n' \
|
||||
'Dot-Zsh commands:' \
|
||||
'' \
|
||||
' just setup all # full setup flow' \
|
||||
' just setup base # base layer only' \
|
||||
' just setup stow # stow Zsh files into $HOME' \
|
||||
' just setup clean # remove stowed Zsh files from $HOME' \
|
||||
' just setup update # git pull + full setup' \
|
||||
'' \
|
||||
' just lang node # install Node tooling' \
|
||||
' just lang go # install Go tooling' \
|
||||
' just lang rust # install Rust tooling' \
|
||||
' just lang python # install Python tooling' \
|
||||
' just lang r # install R tooling' \
|
||||
' just lang cpp # install C/C++ tooling' \
|
||||
'' \
|
||||
' just bin install-all # install all pinned binaries' \
|
||||
' just bin install nvim # install one pinned binary' \
|
||||
' just bin update nvim # update pinned version for a binary' \
|
||||
' just bin list nvim # list available releases' \
|
||||
' just bin show # print current pinned versions'
|
||||
|
||||
setup action='all':
|
||||
case '{{action}}' in \
|
||||
all) bash '{{scripts_dir}}/setup.sh' ;; \
|
||||
base) bash '{{scripts_dir}}/base.sh' ;; \
|
||||
stow) bash '{{scripts_dir}}/setup.sh' --stow-only ;; \
|
||||
clean) stow --dir='{{project_root}}' -D Zsh --target="$HOME" ;; \
|
||||
update) git -C '{{project_root}}' pull origin main && just --justfile '{{project_root}}/Justfile' setup all ;; \
|
||||
*) printf 'Unknown setup action: %s\n' '{{action}}' >&2; exit 1 ;; \
|
||||
esac
|
||||
|
||||
lang tool:
|
||||
case '{{tool}}' in \
|
||||
node) bash '{{scripts_dir}}/node.sh' ;; \
|
||||
go) bash '{{scripts_dir}}/go.sh' ;; \
|
||||
rust) bash '{{scripts_dir}}/rust.sh' ;; \
|
||||
python) bash '{{scripts_dir}}/python.sh' ;; \
|
||||
r) bash '{{scripts_dir}}/r.sh' ;; \
|
||||
cpp) bash '{{scripts_dir}}/cpp.sh' ;; \
|
||||
*) printf 'Unknown language target: %s\n' '{{tool}}' >&2; exit 1 ;; \
|
||||
esac
|
||||
|
||||
bin action='show' tool='' version='':
|
||||
case '{{action}}' in \
|
||||
install-all) bash '{{bin_script_dir}}/install.sh' --all ;; \
|
||||
install) [ -n '{{tool}}' ] || { printf 'bin install requires a tool name\n' >&2; exit 1; }; bash '{{bin_script_dir}}/install.sh' '{{tool}}' ;; \
|
||||
update) [ -n '{{tool}}' ] || { printf 'bin update requires a tool name\n' >&2; exit 1; }; bash '{{bin_script_dir}}/update.sh' '{{tool}}' '{{version}}' ;; \
|
||||
list) [ -n '{{tool}}' ] || { printf 'bin list requires a tool name\n' >&2; exit 1; }; bash '{{bin_script_dir}}/update.sh' --list '{{tool}}' ;; \
|
||||
show) cat '{{project_root}}/Bins/versions.json' ;; \
|
||||
*) printf 'Unknown bin action: %s\n' '{{action}}' >&2; exit 1 ;; \
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user