Move dynamic fish completions to their own autogenerated files

This commit is contained in:
ViViDboarder 2025-01-16 12:48:26 -08:00
parent 605cf38719
commit 4a0732afbc
7 changed files with 20 additions and 25 deletions

View File

@ -0,0 +1,3 @@
if type -q colima
colima completion fish | source
end

View File

@ -0,0 +1,3 @@
if type -q golangci-lint
golangci-lint completion fish | source
end

View File

@ -0,0 +1,3 @@
if type -q kubectl
kubectl completion fish | source
end

View File

@ -0,0 +1,3 @@
if type -q pipx
register-python-argcomplete --shell fish pipx | source
end

View File

@ -0,0 +1,3 @@
if type -q scw
scw autocomplete script shell=fish | source
end

View File

@ -0,0 +1,5 @@
complete --command yk --no-files
complete --command yk --arguments "(yk list)" --description "Credential to get TOTP for"
complete --command yk --old-option "debug" --description "enable debug logging"
complete --command yk --old-option "version" --description "print version and exit"
complete --command yk --old-option "set-password" --description "prompt for key password and store in system keychain"

View File

@ -1,25 +0,0 @@
function update_completions --description "Update completions for a command" --argument-names "target_command"
# Usage: update_completions kubectl completion fish
#
# This generates new completions, sources them, and then saves it to your
# user completions directory for future loading.
if not set -q target_command ; or [ -z "$target_command" ]
echo "Must pass some command to generate completions. eg: update_completions kubectl completion fish" 1>&2
return 1
end
set --local completion_dir "$HOME/.config/fish/completions"
if set -q XDG_CONFIG_HOME
set --local completion_dir "$XDG_CONFIG_HOME"
end
if [ "$target_command" = "register-python-argcomplete" ]
echo "Command was py $argv[-1]"
set target_command $argv[-1]
end
set --local completion_path "$completion_dir/$target_command.fish"
eval $argv[1..] | tee "$completion_path" | source
echo "Completions for $target_command generated, sourced, and stored in $completion_path for future shells" 1>&2
end