Fix: Changes to have command usage

This commit is contained in:
2023-05-05 22:59:14 +03:00
parent edd56c80eb
commit e5fe49834d
6 changed files with 24 additions and 8 deletions

View File

@@ -164,7 +164,9 @@ function section_brew
menu_usage "$USAGE_PREFIX" "${MENU[@]}" menu_usage "$USAGE_PREFIX" "${MENU[@]}"
;; ;;
esac esac
} || menu_section "$USAGE_PREFIX" "brew not available on this system" }
! have brew && menu_section "$USAGE_PREFIX" "brew not available on this system"
} }
function section_dotfiles function section_dotfiles
@@ -207,7 +209,8 @@ function section_dotfiles
;; ;;
yamlfmt) yamlfmt)
# format yaml files # format yaml files
have yamlfmt && yamlfmt -conf "$DOTFILES/.yamlfmt" || msg_err "yamlfmt not found" have yamlfmt && yamlfmt -conf "$DOTFILES/.yamlfmt"
! have yamlfmt && msg_err "yamlfmt not found"
;; ;;
shfmt) shfmt)
# Format shell scripts according to following rules. # Format shell scripts according to following rules.

View File

@@ -39,4 +39,7 @@ have gh && {
done done
msg_ok "Done" msg_ok "Done"
} || msg_err "gh (GitHub Client) could not be found, please install it first" }
! have gh \
&& msg_err "gh (GitHub Client) could not be found, please install it first"

View File

@@ -34,4 +34,6 @@ have go && {
done done
msg_ok "Done" msg_ok "Done"
} || msg "go hasn't been installed yet." }
! have go && msg "go hasn't been installed yet."

View File

@@ -36,4 +36,6 @@ have npm && {
msg_run "Upgrading all global packages" msg_run "Upgrading all global packages"
npm -g --no-progress --no-timing --no-fund outdated npm -g --no-progress --no-timing --no-fund outdated
npm -g --no-timing --no-fund upgrade npm -g --no-timing --no-fund upgrade
} || msg_err "npm could not be found." }
! have npm && msg_err "npm could not be found."

View File

@@ -6,9 +6,9 @@
source "$HOME/.dotfiles/scripts/shared.sh" source "$HOME/.dotfiles/scripts/shared.sh"
set -e set -e
have ntfy && { have ntfy && msg "ntfy already installed"
msg "ntfy already installed"
} || { ! have ntfy && {
case $(dfm check arch) in case $(dfm check arch) in
Linux) Linux)
NTFY_ARCH="linux_$(arch)" NTFY_ARCH="linux_$(arch)"

View File

@@ -4,6 +4,12 @@
# Ismo Vuorinen <https://github.com/ivuorinen> 2018 # Ismo Vuorinen <https://github.com/ivuorinen> 2018
# #
[ "$(uname)" != "Darwin" ] && echo "Not a macOS system" && exit 0
! have xcode-select \
&& msg_err "xcode-select could not be found, skipping" \
&& exit 0
# Ask for the administrator password upfront # Ask for the administrator password upfront
sudo -v sudo -v