Permalink
Browse files

fall through to default bash completion

When there are no completions for a command, fall through to default bash completion. Fixes #16.

I also added the patch from #12.
  • Loading branch information...
1 parent 350e39c commit 2abfad747cd1334f0af0f5326556a00b23291f4b @chrisjaure committed Dec 4, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 completions/sub.bash
View
@@ -6,9 +6,13 @@ _sub() {
COMPREPLY=( $(compgen -W "$(sub commands)" -- "$word") )
else
local command="${COMP_WORDS[1]}"
- local completions="$(sub completions "$command")"
- COMPREPLY=( $(compgen -W "$completions" -- "$word") )
+ local completions="$(sub completions "$command" ${COMP_WORDS[@]:2})"
+ if [ "$completions" ]; then
+ COMPREPLY=( $(compgen -W "$completions" -- "$word") )
+ else
+ return 1
+ fi
fi
}
-complete -F _sub sub
+complete -o default -F _sub sub

0 comments on commit 2abfad7

Please sign in to comment.