feat(just): add assert utility function/recipe
This commit is contained in:
parent
b11ca6bd05
commit
138bb67ffb
2 changed files with 14 additions and 2 deletions
|
|
@ -5,5 +5,6 @@
|
||||||
ls -1 ../systems/x86_64-linux/
|
ls -1 ../systems/x86_64-linux/
|
||||||
|
|
||||||
[doc('Update the target machine')]
|
[doc('Update the target machine')]
|
||||||
update machine:
|
@update machine:
|
||||||
|
just assert '-d "../systems/x86_64-linux/{{ machine }}"' "Machine {{ machine }} does not exist, must be one of: $(ls ../systems/x86_64-linux/ | tr '\n' ' ')"
|
||||||
nixos-rebuild switch --use-remote-sudo --target-host {{ machine }} --flake ..#{{ machine }}
|
nixos-rebuild switch --use-remote-sudo --target-host {{ machine }} --flake ..#{{ machine }}
|
||||||
13
.justfile
13
.justfile
|
|
@ -19,4 +19,15 @@ mod machine '.just/machine.just'
|
||||||
|
|
||||||
[doc('Introspection on flake output')]
|
[doc('Introspection on flake output')]
|
||||||
@select key:
|
@select key:
|
||||||
nix eval --json .#{{ key }} | jq .
|
nix eval --json .#{{ key }} | jq .
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#===============================================================================================
|
||||||
|
# Utils
|
||||||
|
#===============================================================================================
|
||||||
|
[no-exit-message]
|
||||||
|
[no-cd]
|
||||||
|
[private]
|
||||||
|
@assert condition message:
|
||||||
|
[ {{ condition }} ] || { echo -e 1>&2 "\n\x1b[1;41m Error \x1b[0m {{ message }}\n"; exit 1; }
|
||||||
Loading…
Add table
Add a link
Reference in a new issue