Skip to content

Commit

Permalink
refactor(fish): replace command with type query
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeijn committed Jan 31, 2025
1 parent 86e60af commit 89defbb
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion chezmoi/dot_config/fish/conf.d/99_bitwarden_tokens.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
##############################################

function __load_tokens_if_rbw_unlocks --on-event rbw-unlocked
if command -v rbw >/dev/null 2>&1
if type -q rbw
if rbw unlocked >/dev/null 2>&1
echo "🔓🗝️ Session unlocked, loading tokens from Bitwarden... 🔓🗝️"

Expand Down
14 changes: 7 additions & 7 deletions chezmoi/dot_config/fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if command -v git-town &> /dev/null
alias gt='git-town'
end

if command -v kubectl &>/dev/null
if type -q kubectl
function kubectl --wraps kubectl
command kubecolor $argv
end
Expand All @@ -29,7 +29,7 @@ if command -v kubectl &>/dev/null
set -x KUBECTL_EXTERNAL_DIFF "dyff between --omit-header --set-exit-code"
end

if command -v aws_completer &>/dev/null
if type -q aws_completer
# Enable AWS CLI autocompletion: https://github.com/aws/aws-cli/issues/1079#issuecomment-541997810
complete --command aws --no-files --arguments '(begin; set --local --export COMP_SHELL fish; set --local --export COMP_LINE (commandline); aws_completer | sed \'s/ $//\'; end)'
end
Expand All @@ -47,8 +47,8 @@ if test -f ~/.env
end

# ENHANCE!
command -v fixit >/dev/null; and fixit init fish | source
command -v zoxide >/dev/null; and zoxide init --cmd cd fish | source
command -v atuin >/dev/null; and atuin init fish | source
#command -v savvy >/dev/null; and savvy init fish | source # Disabled: not currently used, so saving in Fish startup costs.
command -v starship >/dev/null; and starship init fish | source
type -q fixit; and fixit init fish | source
type -q zoxide; and zoxide init --cmd cd fish | source
type -q atuin; and atuin init fish | source
#type -q savvy; and savvy init fish | source # Disabled: not currently used, so saving in Fish startup costs.
type -q starship; and starship init fish | source
23 changes: 13 additions & 10 deletions chezmoi/dot_config/fish/functions/update_completions.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,40 @@ function update_completions
return
end

if command -v aqua >/dev/null
if type -q aqua
aqua completion fish >"$_completion_dir/aqua.fish"
end
if command -v lab >/dev/null
if type -q lab
lab completion fish >"$_completion_dir/lab.fish"
end
if command -v glab >/dev/null
if type -q glab
glab completion -s fish >"$_completion_dir/glab.fish"
end
if command -v mise >/dev/null
if type -q mise
mise completion fish >"$_completion_dir/mise.fish"
end
if command -v rbw >/dev/null
if type -q rbw
rbw gen-completions fish >"$_completion_dir/rbw.fish"
end
if command -v ghorg >/dev/null
if type -q ghorg
ghorg completion fish >"$_completion_dir/ghorg.fish"
end
if command -v starship >/dev/null
if type -q starship
starship completions fish >"$_completion_dir/starship.fish"
end
if command -v tenv >/dev/null
if type -q tenv
tenv completion fish >"$_completion_dir/tenv.fish"
end
if command -v kubectl >/dev/null
if type -q kubectl
kubectl completion fish >"$_completion_dir/kubectl.fish"
end
if command -v git-town >/dev/null
git-town completions fish >"$_completion_dir/git-town.fish"
end
if command -v fzf >/dev/null
if type -q fzf
fzf --fish >"$_completion_dir/fzf.fish"
end
if type -q chezmoi
chezmoi completion fish >"$_completion_dir/chezmoi.fish"
end
end
4 changes: 2 additions & 2 deletions chezmoi/dot_config/mise/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ pipx = "latest"
"cargo:racum/uuinfo" = "HEAD"
"cargo:rbw" = "1.13.1"
"cargo:ripgrep_all" = "latest"
"cargo:serie" = "latest"
"cargo:zeitfetch" = "latest"

###############
Expand All @@ -62,13 +61,14 @@ pipx = "latest"
# UBI Packages #
################
"ubi:aws-cloudformation/rain" = "1.20.2"
"ubi:imsnif/bandwhich" = "latest"
"ubi:darkhz/bluetuith" = "latest"
"ubi:eugene-babichenko/fixit" = "0.9.0"
"ubi:fioncat/otree" = "0.3.1"
"ubi:gdubicki/ets" = "0.3.0"
"ubi:imsnif/bandwhich" = "latest"
"ubi:jacek-kurlit/pik" = "0.14.1"
"ubi:joschi/dive" = "0.13.1"
"ubi:lusingander/serie" = "0.4.3"

[settings]
# Issues I'd like to see implemented/fixed before enabling uvx for all packages:
Expand Down

0 comments on commit 89defbb

Please sign in to comment.