From 9dd90eff7023d6f791d98bd3cbdb56496d53d8f2 Mon Sep 17 00:00:00 2001 From: Luca Grulla Date: Sun, 24 Jan 2021 18:12:52 +0000 Subject: [PATCH] add autocomplete files --- cw.bash | 9 +++++++++ cw.zsh | 13 +++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 cw.bash create mode 100644 cw.zsh diff --git a/cw.bash b/cw.bash new file mode 100644 index 00000000..3682600f --- /dev/null +++ b/cw.bash @@ -0,0 +1,9 @@ +_cw_bash_autocomplete() { + local cur prev opts base + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + opts=$( ${COMP_WORDS[0]} --completion-bash ${COMP_WORDS[@]:1:$COMP_CWORD} ) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 +} +complete -F _cw_bash_autocomplete cw \ No newline at end of file diff --git a/cw.zsh b/cw.zsh new file mode 100644 index 00000000..fadab583 --- /dev/null +++ b/cw.zsh @@ -0,0 +1,13 @@ +#compdef cw +autoload -U compinit && compinit +autoload -U bashcompinit && bashcompinit + +_cw_bash_autocomplete() { + local cur prev opts base + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + opts=$( ${COMP_WORDS[0]} --completion-bash ${COMP_WORDS[@]:1:$COMP_CWORD} ) + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 +} +complete -F _cw_bash_autocomplete cw \ No newline at end of file