From a7ee0948d5a8551cf2a0f08702511fd220e900fc Mon Sep 17 00:00:00 2001 From: Julien Rabier Date: Wed, 22 Jul 2020 10:44:38 +0200 Subject: [PATCH] [zsh] add scaleway cli autocompletion --- dot_zsh/scw-completion.zsh | 9 +++++++++ dot_zshrc.tmpl | 1 + 2 files changed, 10 insertions(+) create mode 100644 dot_zsh/scw-completion.zsh diff --git a/dot_zsh/scw-completion.zsh b/dot_zsh/scw-completion.zsh new file mode 100644 index 0000000..748d4b4 --- /dev/null +++ b/dot_zsh/scw-completion.zsh @@ -0,0 +1,9 @@ +_scw () { + output=($(scw autocomplete complete zsh -- ${CURRENT} ${words})) + opts=('-S' ' ') + if [[ $output == *= ]]; then + opts=('-S' '') + fi + compadd "${opts[@]}" -- "${output[@]}" +} +compdef _scw scw diff --git a/dot_zshrc.tmpl b/dot_zshrc.tmpl index 9546953..a786e9b 100644 --- a/dot_zshrc.tmpl +++ b/dot_zshrc.tmpl @@ -40,6 +40,7 @@ source ~/.zsh/functions source ~/.zsh/exports source ~/.zsh/dstask-completion.zsh source ~/.zsh/fzf-completion.zsh +source ~/.zsh/scw-completion.zsh {{- if eq .chezmoi.hostname "taupo" }} source ~/.zsh/aliases_taupo