From 6d510cedb99249198963d1bc38e56c8c39f14c1f Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 24 Aug 2014 11:24:52 +0200 Subject: bash completion: make command list dynamic Use "gbp --list-cmds" so we don't have to hardcode the available commands and get support for the RPM ones as they show up. --- debian/git-buildpackage.bash-completion | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/debian/git-buildpackage.bash-completion b/debian/git-buildpackage.bash-completion index c0127041..053b9332 100644 --- a/debian/git-buildpackage.bash-completion +++ b/debian/git-buildpackage.bash-completion @@ -27,6 +27,12 @@ _gbp_options () } +_gbp_commands () +{ + gbp --list-cmds | sed -ne 's/^ \+\([a-z\-]\+\) \-.*/\1/p' +} + + _gbp_comp () { local cur="${COMP_WORDS[COMP_CWORD]}" @@ -208,15 +214,7 @@ have gbp && _gbp () { local cur="${COMP_WORDS[COMP_CWORD]}" - local commands="buildpackage \ - clone \ - create-remote-repo \ - dch \ - import-dsc \ - import-dscs \ - import-orig \ - pq \ - pull" + local commands=$(_gbp_commands) local func command=$(_gbp_find_cmd_on_cmdline "$commands") -- cgit v1.2.3