diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-12-09 12:11:16 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-12-09 12:31:23 +0100 |
commit | be44031df338c53150701d2f3328eac3d91d7f61 (patch) | |
tree | 9006f0a02ae76853ff42580cc5ecace15d4ddf0a | |
parent | ef1d8e7250776a282eec3183d413141448a7be2f (diff) |
gbp create-remote-repo: Autocomplete --remote-config= too
-rw-r--r-- | debian/gbp.completion | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/debian/gbp.completion b/debian/gbp.completion index 3cbf64bf..5bb23eac 100644 --- a/debian/gbp.completion +++ b/debian/gbp.completion @@ -21,6 +21,14 @@ _gbp_tags () } +_gbp_remote_configs () +{ + GBP_DISABLE_GBP_CONF_DEPRECTATION=true \ + GBP_DISABLE_SECTION_DEPRECTATION=true \ + gbp create-remote-repo list | sed -ne 's/^ \+\([a-z]\+\)/\1/p' +} + + _gbp_options () { GBP_DISABLE_GBP_CONF_DEPRECTATION=true \ @@ -44,6 +52,7 @@ _gbp_comp () local tag_opts=${3:-"--debian-tag\= --upstream-tag\="} local tristate_opts=${4:-"--color\="} local cbdist_opts=${5:-"--git-dist\="} + local remote_config_opts="--remote-config\=" # COMPREPLY considers '=' as a word. For $prev we prefer the word before the actual "=" if [[ "$prev" == "=" ]]; then @@ -76,6 +85,12 @@ _gbp_comp () return 0 fi + if [[ "${remote_config_opts}" == *$prev* ]]; then + local remote_configs=$(_gbp_remote_configs) + COMPREPLY=( $(compgen -W "$remote_configs" -- $cur ) ) + 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') @@ -122,6 +137,14 @@ _gbp-pq () } +_gbp-create-remote-repo () +{ + local options=$(_gbp_options create-remote-repo) + options="$options list" + _gbp_comp "$options" +} + + _gbp-generic-cmd() { local options=$(_gbp_options "${1}") |