diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-01-07 09:54:10 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-01-07 09:58:16 +0100 |
commit | d9ed28612f7504252928c6ace037e84081950bfc (patch) | |
tree | a4f4b68c19373e9c6dbd484a8d5dca012ee8621e | |
parent | 3f05ebad49ee6f5fa6109aed1e656f10de16d514 (diff) |
bash completion: avoid space after options taking an argument
This makes branch and tag completion more useful.
-rw-r--r-- | debian/git-buildpackage.bash-completion | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/debian/git-buildpackage.bash-completion b/debian/git-buildpackage.bash-completion index 57b26758..8c61170d 100644 --- a/debian/git-buildpackage.bash-completion +++ b/debian/git-buildpackage.bash-completion @@ -60,7 +60,12 @@ _gbp_comp () return 0 fi - COMPREPLY=($(compgen -W "$options" -- $cur)) + # separate opts by tab so we can append a space to all options not ending + # with an equal sign + tab_opts=$(echo "$options" | sed -e 's/ \+/\t/g' -e 's/[^=]$/& /g') + type compopt &>/dev/null && compopt -o nospace + local IFS=$'\t\n' + COMPREPLY=($(compgen -W "$tab_opts" -- $cur)) } |