Commit 15187ba6 authored by Guido Günther's avatar Guido Günther

bash-completion: Avoid passing around default options

All commands except for 'buildackage' share the same option names. Don't
pass them around needlesly. Since these names only indicate the type
of completion it doesn't matter if we have them for commands that don't
support them.
parent 451ec187
......@@ -38,9 +38,10 @@ _gbp_comp ()
local cur="${COMP_WORDS[COMP_CWORD]}"
local prev="${COMP_WORDS[COMP_CWORD - 1]}"
local options=$1
local branch_opts=$2
local tag_opts=$3
local tristate_opts=$4
local branch_opts=${2:-"--debian-branch\= --upstream-branch\="}
local tag_opts=${3:-"--debian-tag\= --upstream-tag\="}
local tristate_opts=${4:-"--color\="}
local cbdist_opts=${5:-"--git-dist\="}
# COMPREPLY considers '=' as a word. For $prev we prefer the word before the actual "="
if [[ "$prev" == "=" ]]; then
......@@ -105,7 +106,6 @@ _gbp-buildpackage()
local branch_opts="--git-debian-branch\= --git-upstream-branch\= --git-upstream-tree\="
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" \
"$cbdist_opts"
......@@ -114,79 +114,50 @@ _gbp-buildpackage()
_gbp-dch ()
{
local options=$(_gbp_options dch)
local branch_opts="--debian-branch\="
local tag_opts="--debian-tag\= --upstream-tag\="
local tristate_opts="--color\="
_gbp_comp "$options" "$branch_opts" "$tag_opts" "$tristate_opts"
_gbp_comp "$options"
}
_gbp-import-orig ()
{
local options=$(_gbp_options import-orig)
local branch_opts="--debian-branch\= --upstream-branch\="
local tag_opts="--debian-tag\= --upstream-tag\="
local tristate_opts="--color\="
_gbp_comp "$options" "$branch_opts" "$tag_opts" "$tristate_opts"
_gbp_comp "$options"
}
_gbp-import-dsc ()
{
local options=$(_gbp_options import-dsc)
local branch_opts="--debian-branch\= --upstream-branch\="
local tag_opts="--debian-tag\= --upstream-tag\="
local tristate_opts="--color\="
_gbp_comp "$options" "$branch_opts" "$tag_opts" "$tristate_opts"
_gbp_comp "$options"
}
_gbp-import-dscs ()
{
local options="$(_gbp_options import-dscs) $(_gbp_options import-dsc)"
local branch_opts="--debian-branch\= --upstream-branch\="
local tag_opts="--debian-tag\= --upstream-tag\="
local tristate_opts="--color\="
_gbp_comp "$options" "$branch_opts" "$tag_opts" "$tristate_opts"
_gbp_comp "$options"
}
_gbp-pq ()
{
local options=$(_gbp_options pq)
options="$options export import rebase drop apply switch"
local tristate_opts="--color\="
_gbp_comp "$options" "" "" "$tristate_opts"
_gbp_comp "$options"
}
_gbp-pull ()
{
local options=$(_gbp_options pull)
local branch_opts="--debian-branch\= --upstream-branch\="
local tag_opts="--debian-tag\= --upstream-tag\="
local tristate_opts="--color\="
_gbp_comp "$options" "$branch_opts" "$tag_opts" "$tristate_opts"
_gbp_comp "$options"
}
_gbp-clone ()
{
local options=$(_gbp_options clone)
local branch_opts="--debian-branch\= --upstream-branch\="
local tag_opts="--debian-tag\= --upstream-tag\="
local tristate_opts="--color\="
_gbp_comp "$options" "$branch_opts" "$tag_opts" "$tristate_opts"
_gbp_comp "$options"
}
_gbp-create-remote-repo ()
{
local options=$(_gbp_options create-remote-repo)
local branch_opts="--debian-branch\= --upstream-branch\="
local tristate_opts="--color\="
_gbp_comp "$options" "$branch_opts" "" "$tristate_opts"
_gbp_comp "$options"
}
have gbp &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment