Use _init_completion() in completions/l*.

This commit is contained in:
Ville Skyttä 2011-04-20 22:22:51 +03:00
parent 3842fc5472
commit 69ecdc49d5
12 changed files with 109 additions and 201 deletions

View File

@ -4,12 +4,10 @@ have larch || return
_larch() _larch()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=() if [[ $cword -eq 1 || "$prev" == -* ]]; then
_get_comp_words_by_ref cur prev
if [[ $COMP_CWORD -eq 1 || "$prev" == -* ]]; then
COMPREPLY=( $( compgen -W ' \ COMPREPLY=( $( compgen -W ' \
my-id my-default-archive register-archive whereis-archive archives \ my-id my-default-archive register-archive whereis-archive archives \
init-tree tree-root tree-version set-tree-version inventory \ init-tree tree-root tree-version set-tree-version inventory \

View File

@ -4,10 +4,8 @@ have ldapvi || return
_ldapvi() _ldapvi()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-h|--host) -h|--host)

View File

@ -3,10 +3,8 @@
have lftp && have lftp &&
_lftp() _lftp()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-f) -f)
@ -33,9 +31,8 @@ complete -F _lftp lftp
have lftpget && have lftpget &&
_lftpget() _lftpget()
{ {
COMPREPLY=() local cur prev words cword
local cur _init_completion || return
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]] ; then if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '-c -d -v' -- "$cur" ) ) COMPREPLY=( $( compgen -W '-c -d -v' -- "$cur" ) )

View File

@ -10,10 +10,8 @@ _lilo_labels()
_lilo() _lilo()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-C|-i|-m|-s|-S) -C|-i|-m|-s|-S)

View File

@ -4,10 +4,8 @@ have links || return
_links() _links()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
case $cur in case $cur in
--*) --*)

View File

@ -81,10 +81,11 @@ _lintian_arches()
_lintian() _lintian()
{ {
local cur prev action lint_actions general_opts behaviour_opts \ local cur prev words cword
configuration_opts selection_opts _init_completion || return
_get_comp_words_by_ref cur prev local action lint_actions general_opts behaviour_opts \
configuration_opts selection_opts
lint_actions="--setup-lab --remove-lab --check --check-part --tags \ lint_actions="--setup-lab --remove-lab --check --check-part --tags \
--tags-from-file --ftp-master-rejects --dont-check-part \ --tags-from-file --ftp-master-rejects --dont-check-part \
@ -164,9 +165,8 @@ complete -F _lintian lintian
_lintian_info() _lintian_info()
{ {
local cur prev local cur prev words cword
_init_completion || return
_get_comp_words_by_ref cur prev
case "$prev" in case "$prev" in
-t|--tags) -t|--tags)

View File

@ -5,10 +5,8 @@ have lisp || return
_lisp() _lisp()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
# completing an option (may or may not be separated by a space) # completing an option (may or may not be separated by a space)
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then

View File

@ -4,9 +4,8 @@ have lrzip || return
_lrzip() _lrzip()
{ {
COMPREPLY=() local cur prev words cword
local cur prev _init_completion || return
_get_comp_words_by_ref cur prev
if [[ "$cur" == -* && $prev != -N ]]; then if [[ "$cur" == -* && $prev != -N ]]; then
COMPREPLY=( $( compgen -W '-w -d -o -O -S -f -D -q -L -n -l -b -g -M \ COMPREPLY=( $( compgen -W '-w -d -o -O -S -f -D -q -L -n -l -b -g -M \

View File

@ -4,9 +4,8 @@ have lsof || return
_lsof() _lsof()
{ {
COMPREPLY=() local cur prev words cword
local cur prev _init_completion || return
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-'?'|-h|+c|-c|-d|-F|-i|+r|-r|-s|-S|-T) -'?'|-h|+c|-c|-d|-F|-i|+r|-r|-s|-S|-T)

View File

@ -33,13 +33,13 @@ _sizes()
_args() _args()
{ {
args=0 args=0
if [[ "${COMP_WORDS[0]}" == lvm ]]; then if [[ "${words[0]}" == lvm ]]; then
offset=2 offset=2
else else
offset=1 offset=1
fi fi
for (( i=$offset; i < COMP_CWORD; i++ )); do for (( i=$offset; i < cword; i++ )); do
if [[ "${COMP_WORDS[i]}" != -* ]]; then if [[ "${words[i]}" != -* ]]; then
args=$(($args + 1)) args=$(($args + 1))
fi fi
done done
@ -47,10 +47,8 @@ _args()
_lvmdiskscan() _lvmdiskscan()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --help \ COMPREPLY=( $( compgen -W '--debug --help \
@ -61,10 +59,8 @@ complete -F _lvmdiskscan lvmdiskscan
_pvscan() _pvscan()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup \ COMPREPLY=( $( compgen -W '--debug --exported --novolumegroup \
@ -76,10 +72,8 @@ complete -F _pvscan pvscan
_pvs() _pvs()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-o|-O|--options|--sort) -o|-O|--options|--sort)
@ -108,10 +102,8 @@ complete -F _pvs pvs
_pvdisplay() _pvdisplay()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
--units) --units)
@ -131,10 +123,8 @@ complete -F _pvdisplay pvdisplay
_pvchange() _pvchange()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|-x|--autobackup|--allocatable) -A|-x|--autobackup|--allocatable)
@ -156,10 +146,8 @@ complete -F _pvchange pvchange
_pvcreate() _pvcreate()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
--restorefile) --restorefile)
@ -194,10 +182,8 @@ complete -F _pvcreate pvcreate
_pvmove() _pvmove()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -221,10 +207,8 @@ complete -F _pvmove pvmove
_pvremove() _pvremove()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --force \ COMPREPLY=( $( compgen -W '--debug --force \
@ -237,10 +221,8 @@ complete -F _pvremove pvremove
_vgscan() _vgscan()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --help \ COMPREPLY=( $( compgen -W '--debug --help \
@ -252,10 +234,8 @@ complete -F _vgscan vgscan
_vgs() _vgs()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-o|-O|--options|--sort) -o|-O|--options|--sort)
@ -286,10 +266,8 @@ complete -F _vgs vgs
_vgdisplay() _vgdisplay()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
--units) --units)
@ -310,10 +288,8 @@ complete -F _vgdisplay vgdisplay
_vgchange() _vgchange()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-a|-A|-x|--available|--autobackup|--resizeable) -a|-A|-x|--available|--autobackup|--resizeable)
@ -336,10 +312,8 @@ complete -F _vgchange vgchange
_vgcreate() _vgcreate()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -374,10 +348,8 @@ complete -F _vgcreate vgcreate
_vgremove() _vgremove()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --help --test \ COMPREPLY=( $( compgen -W '--debug --help --test \
@ -390,10 +362,8 @@ complete -F _vgremove vgremove
_vgrename() _vgrename()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -413,10 +383,8 @@ complete -F _vgrename vgrename
_vgreduce() _vgreduce()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -443,10 +411,8 @@ complete -F _vgreduce vgreduce
_vgextend() _vgextend()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -475,10 +441,8 @@ complete -F _vgextend vgextend
_vgport() _vgport()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--all --debug \ COMPREPLY=( $( compgen -W '--all --debug \
@ -491,10 +455,8 @@ complete -F _vgport vgimport vgexport
_vgck() _vgck()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug \ COMPREPLY=( $( compgen -W '--debug \
@ -507,10 +469,8 @@ complete -F _vgck vgck
_vgconvert() _vgconvert()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-M|--metadatatype) -M|--metadatatype)
@ -539,10 +499,8 @@ complete -F _vgconvert vgconvert
_vgcfgbackup() _vgcfgbackup()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-f|--file) -f|--file)
@ -563,10 +521,8 @@ complete -F _vgcfgbackup vgcfgbackup
_vgcfgrestore() _vgcfgrestore()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-f|--file) -f|--file)
@ -595,10 +551,8 @@ complete -F _vgcfgrestore vgcfgrestore
_vgmerge() _vgmerge()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -618,10 +572,8 @@ complete -F _vgmerge vgmerge
_vgsplit() _vgsplit()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -651,10 +603,8 @@ complete -F _vgsplit vgsplit
_vgmknodes() _vgmknodes()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--debug --help --verbose \ COMPREPLY=( $( compgen -W '--debug --help --verbose \
@ -667,10 +617,8 @@ complete -F _vgmknodes vgmknodes
_lvscan() _lvscan()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--blockdevice --debug \ COMPREPLY=( $( compgen -W '--blockdevice --debug \
@ -682,10 +630,8 @@ complete -F _lvscan lvscan
_lvs() _lvs()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-o|-O|--options|--sort) -o|-O|--options|--sort)
@ -713,10 +659,8 @@ complete -F _lvs lvs
_lvdisplay() _lvdisplay()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
--units) --units)
@ -736,10 +680,8 @@ complete -F _lvdisplay lvdisplay
_lvchange() _lvchange()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-a|-A|-C|-M|--available|--autobackup|--continguous|--persistent) -a|-A|-C|-M|--available|--autobackup|--continguous|--persistent)
@ -767,10 +709,8 @@ complete -F _lvchange lvchange
_lvcreate() _lvcreate()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|-C|-M|-Z|--autobackup|--continguous|--persistent|--zero) -A|-C|-M|-Z|--autobackup|--continguous|--persistent|--zero)
@ -811,10 +751,8 @@ complete -F _lvcreate lvcreate
_lvremove() _lvremove()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -834,10 +772,8 @@ complete -F _lvremove lvremove
_lvrename() _lvrename()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -857,10 +793,8 @@ complete -F _lvrename lvrename
_lvreduce() _lvreduce()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -885,10 +819,8 @@ complete -F _lvreduce lvreduce
_lvresize() _lvresize()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -919,10 +851,8 @@ complete -F _lvresize lvresize
_lvextend() _lvextend()
{ {
local cur prev local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
case $prev in case $prev in
-A|--autobackup) -A|--autobackup)
@ -953,12 +883,10 @@ complete -F _lvextend lvextend
_lvm() _lvm()
{ {
local cur local cur prev words cword
_init_completion || return
COMPREPLY=() if [ $cword -eq 1 ]; then
_get_comp_words_by_ref cur
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \ COMPREPLY=( $( compgen -W 'dumpconfig help lvchange \
lvcreate lvdisplay lvextend lvmchange \ lvcreate lvdisplay lvextend lvmchange \
lvmdiskscan lvmsadc lvmsar lvreduce \ lvmdiskscan lvmsadc lvmsar lvreduce \
@ -971,7 +899,7 @@ _lvm()
vgremove vgrename vgs vgscan vgsplit \ vgremove vgrename vgs vgscan vgsplit \
version' -- "$cur" ) ) version' -- "$cur" ) )
else else
case ${COMP_WORDS[1]} in case ${words[1]} in
pvchange) pvchange)
_pvchange _pvchange
;; ;;

View File

@ -4,10 +4,8 @@ have lzma || return
_lzma() _lzma()
{ {
local cur prev xspec local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 \ COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 \
@ -17,9 +15,8 @@ _lzma()
return 0 return 0
fi fi
local IFS=$'\n' local IFS=$'\n' xspec="*.@(lzma|tlz)"
xspec="*.@(lzma|tlz)"
if [[ "$prev" == --* ]]; then if [[ "$prev" == --* ]]; then
[[ "$prev" == --decompress || \ [[ "$prev" == --decompress || \
"$prev" == --list || \ "$prev" == --list || \

View File

@ -4,10 +4,8 @@ have lzop || return
_lzop() _lzop()
{ {
local cur prev xspec local cur prev words cword
_init_completion || return
COMPREPLY=()
_get_comp_words_by_ref cur prev
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P \ COMPREPLY=( $( compgen -W '-1 -2 -3 -4 -5 -6 -7 -8 -9 -P \
@ -34,7 +32,7 @@ _lzop()
;; ;;
esac esac
xspec="*.?(t)lzo" local xspec="*.?(t)lzo"
case $prev in case $prev in
--decompress|--uncompress|--extract|--list|--ls|--info|--test) --decompress|--uncompress|--extract|--list|--ls|--info|--test)
xspec="!"$xspec xspec="!"$xspec
@ -44,7 +42,7 @@ _lzop()
;; ;;
--*) --*)
;; ;;
-*f*|'<'|'>') -*f*)
xspec= xspec=
;; ;;
-*[dltx]*) -*[dltx]*)