Implement hook enforcement using argparse
This commit is contained in:
parent
1019364aa3
commit
1c983b81ea
|
@ -57,7 +57,7 @@ function runSetup
|
|||
end
|
||||
|
||||
and echo "Installing dependencies..."
|
||||
and runHook installValhallaDeps true 'Please set up a function `installValhallaDeps` for installing `fish`, `git`, `jq`, `nix`, `sudo` and `tmux`.'
|
||||
and runHook --force installValhallaDeps 'Please set up a function `installValhallaDeps` for installing `fish`, `git`, `jq`, `nix`, `sudo` and `tmux`.'
|
||||
|
||||
and echo "Cloning project..."
|
||||
and source "$dir/../../copy-repo.fish" "$mountDir$PROJECT_CLONE_ROOT"
|
||||
|
@ -65,7 +65,7 @@ function runSetup
|
|||
and runHook setupOS
|
||||
|
||||
and echo "Preparing auto-login..."
|
||||
and runHook autologin true "Please set up a function `autologin` for setting up autologin for the `root` user"
|
||||
and runHook --force autologin "Please set up a function `autologin` for setting up autologin for the `root` user"
|
||||
|
||||
and begin
|
||||
set -l script (string escape (getCloneFile (getInstallerScript)))
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
function runHook -S -a name force message
|
||||
function runHook -S
|
||||
argparse "force" -- $argv
|
||||
set -l name $argv[1]
|
||||
set -l message $argv[2]
|
||||
|
||||
if type -q "$name"
|
||||
"$name"
|
||||
or exit 1
|
||||
else if $force
|
||||
else if [ -n "$_flag_force" ]
|
||||
if test -n "$message"
|
||||
echo "$message"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue