[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1.3-353-gc28c06b
Igor Murzov
e-mail at date.by
Wed Jun 8 00:27:33 UTC 2011
The following commit has been merged in the master branch:
commit ac79f44d9055bc7906f81533773eb62ab7997118
Author: Igor Murzov <e-mail at date.by>
Date: Wed Jun 8 04:02:34 2011 +0400
kcov, pkgtools, sbopkg, slapt: Move option completion code after option argument completions
otherwise bogus completions are produced for option argument completions
starting with a dash
diff --git a/completions/kcov b/completions/kcov
index d330a48..3bad12d 100644
--- a/completions/kcov
+++ b/completions/kcov
@@ -5,12 +5,6 @@ _kcov()
local cur prev words cword split
_init_completion -s || return
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
- [[ $COMPREPLY == *= ]] && compopt -o nospace
- return 0
- fi
-
case "$prev" in
--pid|-p)
_pids
@@ -32,6 +26,12 @@ _kcov()
$split && return 0
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ return 0
+ fi
+
_filedir
} && complete -F _kcov kcov
diff --git a/completions/pkgtools b/completions/pkgtools
index df59ad1..e760f8f 100644
--- a/completions/pkgtools
+++ b/completions/pkgtools
@@ -8,12 +8,6 @@ _pkgtool()
{
local cur prev words cword
_init_completion || return
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile \
- --source-mounted --source_dir --target_dir --source_device' \
- -- "$cur" ) )
- return 0
- fi
case "$prev" in
--source_dir|--target_dir)
@@ -33,6 +27,13 @@ _pkgtool()
return 0
;;
esac
+
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile \
+ --source-mounted --source_dir --target_dir --source_device' \
+ -- "$cur" ) )
+ return 0
+ fi
} &&
complete -F _pkgtool pkgtool
@@ -58,6 +59,7 @@ _upgradepkg()
{
local cur prev words cword
_init_completion || return
+
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \
--verbose' -- "$cur") )
@@ -72,11 +74,6 @@ _installpkg()
{
local cur prev words cword
_init_completion || return
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse \
- --menu --ask --priority --tagfile' -- "$cur") )
- return 0
- fi
case "$prev" in
--root)
@@ -93,6 +90,12 @@ _installpkg()
;;
esac
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse \
+ --menu --ask --priority --tagfile' -- "$cur") )
+ return 0
+ fi
+
_filedir "t[bglx]z"
} && complete -F _installpkg installpkg
@@ -101,11 +104,6 @@ _makepkg()
{
local cur prev words cword
_init_completion || return
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend \
- -c --chown' -- "$cur") )
- return 0
- fi
case "$prev" in
-l|--linkadd|-c|--chown)
@@ -114,6 +112,12 @@ _makepkg()
;;
esac
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend \
+ -c --chown' -- "$cur") )
+ return 0
+ fi
+
_filedir
} && complete -F _makepkg makepkg
diff --git a/completions/sbopkg b/completions/sbopkg
index 2baf2fc..532a879 100644
--- a/completions/sbopkg
+++ b/completions/sbopkg
@@ -7,12 +7,6 @@ _sbopkg()
local cur prev words cword
_init_completion || return
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
- -o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
- return 0
- fi
-
case "$prev" in
-e)
COMPREPLY=( $( compgen -W 'ask continue stop' -- "$cur" ) )
@@ -38,6 +32,12 @@ _sbopkg()
;;
esac
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
+ -o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
+ return 0
+ fi
+
local config="/etc/sbopkg/sbopkg.conf"
for (( i=${#words[@]}-1; i>0; i-- )); do
diff --git a/completions/slapt b/completions/slapt
index 33868a0..4856f0a 100644
--- a/completions/slapt
+++ b/completions/slapt
@@ -6,6 +6,17 @@ _slapt_get()
local cur prev words cword
_init_completion || return
+ case "$prev" in
+ --config|-c)
+ _filedir
+ return 0
+ ;;
+ --retry|--search)
+ # argument required but no completions available
+ return 0
+ ;;
+ esac
+
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--download-only -d --simulate -s \
--no-prompt -y --prompt -p --reinstall --ignore-excludes \
@@ -18,17 +29,6 @@ _slapt_get()
return 0
fi
- case "$prev" in
- --config|-c)
- _filedir
- return 0
- ;;
- --retry|--search)
- # argument required but no completions available
- return 0
- ;;
- esac
-
local t
# search for last action (--install|--install-set|--remove|--show|--filelist)
for (( i=${#words[@]}-1; i>0; i-- )); do
@@ -71,14 +71,6 @@ _slapt_src()
local cur prev words cword
_init_completion || return
- if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--update -u --list -l --clean -e \
- --search -s --show -w --install -i --build -b --fetch -f \
- --yes -y --config -c --no-dep -n --postprocess -p \
- --version -v --help -h' -- "$cur" ) )
- return 0
- fi
-
case "$prev" in
--config|-c)
_filedir
@@ -90,6 +82,14 @@ _slapt_src()
;;
esac
+ if [[ "$cur" == -* ]]; then
+ COMPREPLY=( $( compgen -W '--update -u --list -l --clean -e \
+ --search -s --show -w --install -i --build -b --fetch -f \
+ --yes -y --config -c --no-dep -n --postprocess -p \
+ --version -v --help -h' -- "$cur" ) )
+ return 0
+ fi
+
local t
# search for last action (-i|-w|-b|-f)
for (( i=${#words[@]}-1; i>0; i-- )); do
--
bash-completion
More information about the Bash-completion-commits
mailing list