From 4a0732afbc8a6c914981a53b7c39a07d03141c74 Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Thu, 16 Jan 2025 12:48:26 -0800 Subject: [PATCH] Move dynamic fish completions to their own autogenerated files --- assets/default/fish/completions/colima.fish | 3 +++ .../fish/completions/golangci-lint.fish | 3 +++ assets/default/fish/completions/kubectl.fish | 3 +++ assets/default/fish/completions/pipx.fish | 3 +++ assets/default/fish/completions/scw.fish | 3 +++ assets/default/fish/completions/yk.fish | 5 ++++ .../fish/functions/update_completions.fish | 25 ------------------- 7 files changed, 20 insertions(+), 25 deletions(-) create mode 100644 assets/default/fish/completions/colima.fish create mode 100644 assets/default/fish/completions/golangci-lint.fish create mode 100644 assets/default/fish/completions/kubectl.fish create mode 100644 assets/default/fish/completions/pipx.fish create mode 100644 assets/default/fish/completions/scw.fish create mode 100644 assets/default/fish/completions/yk.fish delete mode 100644 assets/default/fish/functions/update_completions.fish diff --git a/assets/default/fish/completions/colima.fish b/assets/default/fish/completions/colima.fish new file mode 100644 index 0000000..4169736 --- /dev/null +++ b/assets/default/fish/completions/colima.fish @@ -0,0 +1,3 @@ +if type -q colima + colima completion fish | source +end diff --git a/assets/default/fish/completions/golangci-lint.fish b/assets/default/fish/completions/golangci-lint.fish new file mode 100644 index 0000000..bebe7c3 --- /dev/null +++ b/assets/default/fish/completions/golangci-lint.fish @@ -0,0 +1,3 @@ +if type -q golangci-lint + golangci-lint completion fish | source +end diff --git a/assets/default/fish/completions/kubectl.fish b/assets/default/fish/completions/kubectl.fish new file mode 100644 index 0000000..5e5509e --- /dev/null +++ b/assets/default/fish/completions/kubectl.fish @@ -0,0 +1,3 @@ +if type -q kubectl + kubectl completion fish | source +end diff --git a/assets/default/fish/completions/pipx.fish b/assets/default/fish/completions/pipx.fish new file mode 100644 index 0000000..c30c4ec --- /dev/null +++ b/assets/default/fish/completions/pipx.fish @@ -0,0 +1,3 @@ +if type -q pipx + register-python-argcomplete --shell fish pipx | source +end diff --git a/assets/default/fish/completions/scw.fish b/assets/default/fish/completions/scw.fish new file mode 100644 index 0000000..0f7b3e9 --- /dev/null +++ b/assets/default/fish/completions/scw.fish @@ -0,0 +1,3 @@ +if type -q scw + scw autocomplete script shell=fish | source +end diff --git a/assets/default/fish/completions/yk.fish b/assets/default/fish/completions/yk.fish new file mode 100644 index 0000000..8bddb06 --- /dev/null +++ b/assets/default/fish/completions/yk.fish @@ -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" diff --git a/assets/default/fish/functions/update_completions.fish b/assets/default/fish/functions/update_completions.fish deleted file mode 100644 index 6b54440..0000000 --- a/assets/default/fish/functions/update_completions.fish +++ /dev/null @@ -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