diff options
author | Guido Günther <agx@sigxcpu.org> | 2011-07-22 23:48:30 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2011-07-22 23:48:30 +0200 |
commit | 8ce3500b66827904504c4b62331520c898103828 (patch) | |
tree | 8502e9b41b3e48e9b51c239934bcae1c250f01bc | |
parent | 1b44228ce73dfb29200c243cb383a3cffacdeafb (diff) | |
download | git-buildpackage-8ce3500b66827904504c4b62331520c898103828.tar.gz git-buildpackage-8ce3500b66827904504c4b62331520c898103828.tar.bz2 git-buildpackage-8ce3500b66827904504c4b62331520c898103828.zip |
Add autocompletion for --git-dist=
based on the available cowbuilder images
-rw-r--r-- | debian/git-buildpackage.bash-completion | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/debian/git-buildpackage.bash-completion b/debian/git-buildpackage.bash-completion index 0f8c9d5e..1a7eecd4 100644 --- a/debian/git-buildpackage.bash-completion +++ b/debian/git-buildpackage.bash-completion @@ -60,6 +60,13 @@ _gbp_comp () return 0 fi + if [[ "${cbdist_opts}" == *$prev* ]]; then + local BASE="/var/cache/pbuilder/base-" + COMPREPLY=( $( compgen -o dirnames -G "${BASE}${cur}*.cow" \ + | sed -e "s,${BASE}\(.*\)\.cow,\1,g" ) ) + return 0 + fi + # 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') @@ -76,8 +83,10 @@ _git_buildpackage() local branch_opts="--git-debian-branch\= --git-upstream-branch\=" local tag_opts="--git-debian-tag\= --git-upstream-tag\=" local tristate_opts="--git-color\= --git-notify\=" + local cbdist_opts="--git-dist\=" - _gbp_comp "$options" "$branch_opts" "$tag_opts" "$tristate_opts" + _gbp_comp "$options" "$branch_opts" "$tag_opts" "$tristate_opts" \ + "$cbdist_opts" } [ "${have:-}" ] && complete -F _git_buildpackage -o default git-buildpackage |