ref: refs/heads/master
commit 93d272435803cfca3bb44cf455fc1a6f6d0562b2
Author: Josef Reidinger
Date: Wed Feb 11 13:59:17 2009 +0100
Bash completion: allow completion after short versions of commands.
---
src/bash-completion.sh | 139 +++++++++++++++++++++++++++++++++++++-----------
1 files changed, 107 insertions(+), 32 deletions(-)
diff --git a/src/bash-completion.sh b/src/bash-completion.sh
index 4dd50a5..d1bfbfc 100644
--- a/src/bash-completion.sh
+++ b/src/bash-completion.sh
@@ -23,100 +23,175 @@ _zypper() {
case "$prev" in
zypper)
- opts=$ZYPPER_CMDLIST
- COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ opts=$ZYPPER_CMDLIST
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- help)
+ help | ?)
+
opts=$ZYPPER_CMDLIST
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- shell)
+ shell | sh)
return 0
;;
- install)
- opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
- COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
- ;;
- remove)
+ repos | lr)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- search)
- opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//' | grep -v '*')
+ addrepo | ar)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- repos)
+ removerepo | rr)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ opts="${opts} $(LC_ALL=C $ZYPPER lr | sed -e '1,2 d' -e 's/^[0-9]\+[[:space:]]\+|[[:space:]]*\([^|]\+\)|.*$/\1/' -e 's/[[:space:]]*$//')"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- addrepo)
+ renamerepo | nr)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ opts="${opts} $(LC_ALL=C $ZYPPER lr | sed -e '1,2 d' -e 's/^[0-9]\+[[:space:]]\+|[[:space:]]*\([^|]\+\)|.*$/\1/' -e 's/[[:space:]]*$//')"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- removerepo)
+ modifyrepo | mr)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
opts2=$(LC_ALL=C $ZYPPER lr | sed -e '1,2 d' -e 's/^[0-9]\+[[:space:]]\+|[[:space:]]*\([^|]\+\)|.*$/\1/' -e 's/[[:space:]]*$//' -e 's/ /\\ /g' -e "s/^\(.*\)$/'\1'/")
opts="${opts} ${opts2}"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- renamerepo)
+ refresh | ref)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
- opts2=$(LC_ALL=C $ZYPPER lr | sed -e '1,2 d' -e 's/^[0-9]\+[[:space:]]\+|[[:space:]]*\([^|]\+\)|.*$/\1/' -e 's/[[:space:]]*$//' -e 's/ /\\ /g' -e "s/^\(.*\)$/'\1'/")
- opts="${opts} ${opts2}"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- modifyrepo)
+ clean)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
- opts2=$(LC_ALL=C $ZYPPER lr | sed -e '1,2 d' -e 's/^[0-9]\+[[:space:]]\+|[[:space:]]*\([^|]\+\)|.*$/\1/' -e 's/[[:space:]]*$//' -e 's/ /\\ /g' -e "s/^\(.*\)$/'\1'/")
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ services | ls)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ addservice | as)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ opts2=$(LC_ALL=C $ZYPPER ls | sed -e '1,2 d' -e 's/^[0-9]\+[[:space:]]\+|[[:space:]]*\([^|]\+\)|.*$/\1/' -e 's/[[:space:]]*$//' -e 's/ /\\ /g' -e "s/^\(.*\)$/'\1'/")
opts="${opts} ${opts2}"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- services)
+ modifyservice | ms)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ opts2=$(LC_ALL=C $ZYPPER ls | sed -e '1,2 d' -e 's/^[0-9]\+[[:space:]]\+|[[:space:]]*\([^|]\+\)|.*$/\1/' -e 's/[[:space:]]*$//' -e 's/ /\\ /g' -e "s/^\(.*\)$/'\1'/")
+ opts="${opts} ${opts2}"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- refresh)
+ removeservice | rs)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ opts2=$(LC_ALL=C $ZYPPER ls | sed -e '1,2 d' -e 's/^[0-9]\+[[:space:]]\+|[[:space:]]*\([^|]\+\)|.*$/\1/' -e 's/[[:space:]]*$//' -e 's/ /\\ /g' -e "s/^\(.*\)$/'\1'/")
+ opts="${opts} ${opts2}"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- patch_check)
+ refresh-services | refs)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ install | in)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ remove | rm)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- patches)
+ verify | ve)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//' | grep -v '*')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ source-install | si)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ install-new-recommends | inr)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ update | up)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ list-updates | lup)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- list-updates)
+ patch)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- xml-updates)
+ list-updates)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- update)
+ dist-upgrade | dup)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- info)
+ patch-check | pchk)
opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
+ search | se)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//' | grep -v '*')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ info | if)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//' | grep -v '*')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
patch-info)
+ COMPREPLY=""
return 0
;;
- source-install)
- opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ pattern-info)
+ COMPREPLY=""
+ return 0
+ ;;
+ product-info)
+ COMPREPLY=""
+ return 0
+ ;;
+ patches | pch)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ packages | pa)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ patterns | pt)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ products | pd)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ what-provides | wp)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ addlock | al)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ removelock | rl)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ ;;
+ locks | ll)
+ opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
"--type")
opts="package patch pattern product"
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
;;
- dist-upgrade)
- opts=$(LC_ALL=C $ZYPPER help $prev 2>&1 | sed -e "1,/$magic_string/d" -e 's/.*--/--/' -e 's/ .*//')
- COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
esac
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org