Skip to content

Commit

Permalink
check_wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
EnigmaCurry committed Oct 15, 2024
1 parent 9236db7 commit 3c2f65c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion config/bash/funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,21 @@ trim_leading_whitespace() { sed -e 's/^[[:space:]]*//'; }
trim_whitespace() { trim_leading_whitespace | trim_trailing_whitespace; }
upper_case() { tr '[:lower:]' '[:upper:]'; }
lower_case() { tr '[:upper:]' '[:lower:]'; }
wizard() { ~/.cargo/bin/script-wizard "$@"; }
check_wizard() {
if ! command -v script-wizard && [[ ! -f ~/.cargo/bin/script-wizard ]]; then
stderr "script-wizard not found. See https://github.com/EnigmaCurry/script-wizard"
fault "Run: cargo install script-wizard"
fi
}
wizard() {
if command -v script-wizard; then
script-wizard "$@"
elif test -f ~/.cargo/bin/script-wizard; then
~/.cargo/bin/script-wizard "$@"
else
check_wizard
fi
}
check_var(){
local __missing=false
local __vars="$@"
Expand Down
2 changes: 1 addition & 1 deletion config/toolbox/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ check_os_id() {
)
}


setup_host_spawn() {
if [[ ! -f /usr/bin/host-spawn ]]; then
echo
Expand Down Expand Up @@ -116,6 +115,7 @@ main() {
fi
else
# Create a new container:
check_wizard
if [[ -z "${NAME}" ]]; then
ask_no_blank "What do you want to name the container?" NAME ${IMAGE}
fi
Expand Down

0 comments on commit 3c2f65c

Please sign in to comment.