From e5017ed42e8fdccfdd4efb5e36c99923a9a24c46 Mon Sep 17 00:00:00 2001 From: Francesco Negri Date: Wed, 16 Jan 2013 14:29:24 +0100 Subject: [PATCH] Append all arguments to --complete Fixes #7 (if using bash) When bash-completion is invoked, all arguments are now forwarded to the command, e.g. sub command arg1 arg2 now triggers: sub --complete command arg1 arg2 instead of just: sub --complete command --- completions/sub.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/completions/sub.bash b/completions/sub.bash index 40eac81..fbdc3fd 100644 --- a/completions/sub.bash +++ b/completions/sub.bash @@ -5,8 +5,8 @@ _sub() { if [ "$COMP_CWORD" -eq 1 ]; then COMPREPLY=( $(compgen -W "$(sub commands)" -- "$word") ) else - local command="${COMP_WORDS[1]}" - local completions="$(sub completions "$command")" + local command="${COMP_WORDS[@]:1:${#COMP_WORDS[@]}-2}" + local completions="$(sub completions $command)" COMPREPLY=( $(compgen -W "$completions" -- "$word") ) fi }