From 30642ab56a62c4fba3d468b8209dbcfa0c3e9b6f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Guido=20G=C3=BCnther?= Date: Sun, 24 Aug 2014 11:24:52 +0200 Subject: [PATCH] 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 c012704..053b933 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") -- 2.7.4