chore(shell): add custom command-path helper

This commit is contained in:
Jim Myhrberg
2024-06-06 18:33:38 +01:00
parent 12b5ecee91
commit d9cb73260e
8 changed files with 16 additions and 12 deletions

View File

@@ -32,5 +32,5 @@ fi
if command-exists orb; then
alias oc="orb"
setup-completions orb "$(command -v orb)" orb completion zsh
setup-completions orb "$(command-path orb)" orb completion zsh
fi

View File

@@ -10,7 +10,7 @@ git-largest-objects() {
sed -n 's/^blob //p' |
sort --numeric-sort --key=2 |
cut -c 1-12,41- |
$(command -v gnumfmt || echo numfmt) \
$(command-path gnumfmt || echo numfmt) \
--field=2 \
--to=iec-i \
--suffix=B \

View File

@@ -9,7 +9,7 @@ alias hl="helm"
alias mk="minikube"
if command-exists kubectl; then
setup-completions kubectl "$(command -v kubectl)" kubectl completion zsh
setup-completions kubectl "$(command-path kubectl)" kubectl completion zsh
export KREW_ROOT="$HOME/.krew"
path_append "${KREW_ROOT}/bin"

View File

@@ -22,10 +22,10 @@ fi
# ==============================================================================
if command-exists rustup; then
setup-completions rustup "$(command -v rustup)" rustup completions zsh
setup-completions rustup "$(command-path rustup)" rustup completions zsh
if command-exists cargo; then
setup-completions cargo "$(command -v cargo)" rustup completions zsh cargo
setup-completions cargo "$(command-path cargo)" rustup completions zsh cargo
fi
fi

View File

@@ -3,7 +3,7 @@
#
if command-exists zoxide; then
cached-eval "$(command -v zoxide)" zoxide init --cmd zox zsh
cached-eval "$(command-path zoxide)" zoxide init --cmd zox zsh
# Use functions to allow regular zsh completion for cd to work.
cd() { __zoxide_z "$@"; }

View File

@@ -47,7 +47,7 @@ setup-completions() {
return 1
fi
if [[ -z "$(command -v "$cmd")" ]]; then
if [[ -z "$(command-path "$cmd")" ]]; then
echo "setup-completions: Command not found: $cmd" >&2
return 1
fi