Use _init_completion() in completions/m*.
This commit is contained in:
parent
69ecdc49d5
commit
0cb6263424
@ -25,11 +25,10 @@ complete -F _list_lists list_lists
|
|||||||
have add_members &&
|
have add_members &&
|
||||||
_add_members()
|
_add_members()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -59,11 +58,10 @@ complete -F _add_members add_members
|
|||||||
have remove_members &&
|
have remove_members &&
|
||||||
_remove_members()
|
_remove_members()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -88,11 +86,10 @@ complete -F _remove_members remove_members
|
|||||||
have find_member &&
|
have find_member &&
|
||||||
_find_member()
|
_find_member()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -115,11 +112,10 @@ complete -F _find_member find_member
|
|||||||
have clone_member &&
|
have clone_member &&
|
||||||
_clone_member()
|
_clone_member()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -142,11 +138,10 @@ complete -F _clone_member clone_member
|
|||||||
have sync_members &&
|
have sync_members &&
|
||||||
_sync_members()
|
_sync_members()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -175,10 +170,8 @@ complete -F _sync_members sync_members
|
|||||||
have unshunt &&
|
have unshunt &&
|
||||||
_unshunt()
|
_unshunt()
|
||||||
{
|
{
|
||||||
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 '--help' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
|
||||||
@ -192,10 +185,8 @@ complete -F _unshunt unshunt
|
|||||||
have list_admins &&
|
have list_admins &&
|
||||||
_list_admins()
|
_list_admins()
|
||||||
{
|
{
|
||||||
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 '--all-vhost --all --help' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '--all-vhost --all --help' -- "$cur" ) )
|
||||||
@ -209,10 +200,8 @@ complete -F _list_admins list_admins
|
|||||||
have list_owners &&
|
have list_owners &&
|
||||||
_list_owners()
|
_list_owners()
|
||||||
{
|
{
|
||||||
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 '--with-listnames --moderators \
|
COMPREPLY=( $( compgen -W '--with-listnames --moderators \
|
||||||
@ -227,11 +216,10 @@ complete -F _list_owners list_owners
|
|||||||
have list_members &&
|
have list_members &&
|
||||||
_list_members()
|
_list_members()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -265,11 +253,10 @@ complete -F _list_members list_members
|
|||||||
have change_pw &&
|
have change_pw &&
|
||||||
_change_pw()
|
_change_pw()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -292,10 +279,8 @@ complete -F _change_pw change_pw
|
|||||||
have withlist &&
|
have withlist &&
|
||||||
_withlist()
|
_withlist()
|
||||||
{
|
{
|
||||||
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 '--lock --interactive \
|
COMPREPLY=( $( compgen -W '--lock --interactive \
|
||||||
@ -310,10 +295,8 @@ complete -F _withlist withlist
|
|||||||
have newlist &&
|
have newlist &&
|
||||||
_newlist()
|
_newlist()
|
||||||
{
|
{
|
||||||
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 '--language --quiet --help' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '--language --quiet --help' -- "$cur" ) )
|
||||||
@ -327,10 +310,8 @@ complete -F _newlist newlist
|
|||||||
have rmlist &&
|
have rmlist &&
|
||||||
_rmlist()
|
_rmlist()
|
||||||
{
|
{
|
||||||
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 '--archives --help' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '--archives --help' -- "$cur" ) )
|
||||||
@ -344,11 +325,10 @@ complete -F _rmlist rmlist
|
|||||||
have config_list &&
|
have config_list &&
|
||||||
_config_list()
|
_config_list()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -375,9 +355,10 @@ complete -F _config_list config_list
|
|||||||
have arch && have mailmanctl &&
|
have arch && have mailmanctl &&
|
||||||
_arch()
|
_arch()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
COMPREPLY=()
|
local split=false
|
||||||
_get_comp_words_by_ref cur prev
|
_get_comp_words_by_ref cur prev
|
||||||
|
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
@ -399,9 +380,9 @@ _arch()
|
|||||||
COMPREPLY=( $( compgen -W '--wipe --start --end --quiet \
|
COMPREPLY=( $( compgen -W '--wipe --start --end --quiet \
|
||||||
--help' -- "$cur" ) )
|
--help' -- "$cur" ) )
|
||||||
else
|
else
|
||||||
args=$COMP_CWORD
|
local args=$cword
|
||||||
for (( i=1; i < COMP_CWORD; i++ )); do
|
for (( i=1; i < cword; i++ )); do
|
||||||
if [[ "${COMP_WORDS[i]}" == -* ]]; then
|
if [[ "${words[i]}" == -* ]]; then
|
||||||
args=$(($args-1))
|
args=$(($args-1))
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -421,10 +402,8 @@ complete -F _arch arch
|
|||||||
have cleanarch &&
|
have cleanarch &&
|
||||||
_cleanarch()
|
_cleanarch()
|
||||||
{
|
{
|
||||||
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 '--status --dry-run --quiet \
|
COMPREPLY=( $( compgen -W '--status --dry-run --quiet \
|
||||||
@ -437,11 +416,10 @@ complete -F _cleanarch cleanarch
|
|||||||
have inject &&
|
have inject &&
|
||||||
_inject()
|
_inject()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -465,10 +443,8 @@ complete -F _inject inject
|
|||||||
have dumpdb &&
|
have dumpdb &&
|
||||||
_dumpdb()
|
_dumpdb()
|
||||||
{
|
{
|
||||||
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 '--marshal --pickle --noprint \
|
COMPREPLY=( $( compgen -W '--marshal --pickle --noprint \
|
||||||
@ -483,10 +459,8 @@ complete -F _dumpdb dumpdb
|
|||||||
have check_db &&
|
have check_db &&
|
||||||
_check_db()
|
_check_db()
|
||||||
{
|
{
|
||||||
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 '--all --verbose --help' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '--all --verbose --help' -- "$cur" ) )
|
||||||
@ -500,10 +474,8 @@ complete -F _check_db check_db
|
|||||||
have check_perms &&
|
have check_perms &&
|
||||||
_check_perms()
|
_check_perms()
|
||||||
{
|
{
|
||||||
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 '-f -v -h' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '-f -v -h' -- "$cur" ) )
|
||||||
@ -515,10 +487,8 @@ complete -F _check_perms check_perms
|
|||||||
have genaliases &&
|
have genaliases &&
|
||||||
_genaliases()
|
_genaliases()
|
||||||
{
|
{
|
||||||
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 '--quiet --help' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '--quiet --help' -- "$cur" ) )
|
||||||
@ -530,10 +500,8 @@ complete -F _genaliases genaliases
|
|||||||
have mmsitepass &&
|
have mmsitepass &&
|
||||||
_mmsitepass()
|
_mmsitepass()
|
||||||
{
|
{
|
||||||
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 '--listcreator --help' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '--listcreator --help' -- "$cur" ) )
|
||||||
@ -545,10 +513,8 @@ complete -F _mmsitepass mmsitepass
|
|||||||
have qrunner &&
|
have qrunner &&
|
||||||
_qrunner()
|
_qrunner()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
_split_longopt && return 0
|
_split_longopt && return 0
|
||||||
|
|
||||||
@ -563,10 +529,8 @@ complete -F _qrunner qrunner
|
|||||||
have mailmanctl &&
|
have mailmanctl &&
|
||||||
_mailmanctl()
|
_mailmanctl()
|
||||||
{
|
{
|
||||||
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 '--no-restart --run-as-user \
|
COMPREPLY=( $( compgen -W '--no-restart --run-as-user \
|
||||||
|
@ -4,10 +4,10 @@ have make || have gmake || have gnumake || have pmake || return
|
|||||||
|
|
||||||
_make()
|
_make()
|
||||||
{
|
{
|
||||||
local file makef makef_dir="." makef_inc cur prev i split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
COMPREPLY=()
|
local file makef makef_dir="." makef_inc i split=false
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
@ -40,20 +40,20 @@ _make()
|
|||||||
else
|
else
|
||||||
# before we check for makefiles, see if a path was specified
|
# before we check for makefiles, see if a path was specified
|
||||||
# with -C/--directory
|
# with -C/--directory
|
||||||
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
|
for (( i=0; i < ${#words[@]}; i++ )); do
|
||||||
if [[ ${COMP_WORDS[i]} == -@(C|-directory) ]]; then
|
if [[ ${words[i]} == -@(C|-directory) ]]; then
|
||||||
# eval for tilde expansion
|
# eval for tilde expansion
|
||||||
eval makef_dir=${COMP_WORDS[i+1]}
|
eval makef_dir=${words[i+1]}
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# before we scan for targets, see if a Makefile name was
|
# before we scan for targets, see if a Makefile name was
|
||||||
# specified with -f/--file/--makefile
|
# specified with -f/--file/--makefile
|
||||||
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
|
for (( i=0; i < ${#words[@]}; i++ )); do
|
||||||
if [[ ${COMP_WORDS[i]} == -@(f|-?(make)file) ]]; then
|
if [[ ${words[i]} == -@(f|-?(make)file) ]]; then
|
||||||
# eval for tilde expansion
|
# eval for tilde expansion
|
||||||
eval makef=${COMP_WORDS[i+1]}
|
eval makef=${words[i+1]}
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
$UNAME == SunOS || $UNAME == Cygwin || $UNAME == OpenBSD ]] &&
|
$UNAME == SunOS || $UNAME == Cygwin || $UNAME == OpenBSD ]] &&
|
||||||
_man()
|
_man()
|
||||||
{
|
{
|
||||||
local cur i prev sect manpath manext mansect uname
|
local cur prev words cword
|
||||||
|
_init_completion -n : || return
|
||||||
|
|
||||||
|
local i sect manpath manext mansect uname
|
||||||
|
|
||||||
manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@([gx]z|bz2|lzma|Z))"
|
manext="@([0-9lnp]|[0-9][px]|man|3pm)?(.@([gx]z|bz2|lzma|Z))"
|
||||||
mansect="@([0-9lnp]|[0-9][px]|3pm)"
|
mansect="@([0-9lnp]|[0-9][px]|3pm)"
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref -n : cur prev
|
|
||||||
|
|
||||||
if [[ "$prev" == -l ]]; then
|
if [[ "$prev" == -l ]]; then
|
||||||
_filedir $manext
|
_filedir $manext
|
||||||
return 0
|
return 0
|
||||||
|
@ -4,11 +4,10 @@ have mc || return
|
|||||||
|
|
||||||
_mc()
|
_mc()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
|
@ -4,10 +4,8 @@ have mcrypt || have mdecrypt || return
|
|||||||
|
|
||||||
_mcrypt()
|
_mcrypt()
|
||||||
{
|
{
|
||||||
local cur prev i decrypt
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-g|--openpgp-z)
|
-g|--openpgp-z)
|
||||||
@ -58,12 +56,12 @@ _mcrypt()
|
|||||||
--force --echo --random --list --list-keymodes \
|
--force --echo --random --list --list-keymodes \
|
||||||
--list-hash --verbose --quiet --help \
|
--list-hash --verbose --quiet --help \
|
||||||
--version --license' -- "$cur" ) )
|
--version --license' -- "$cur" ) )
|
||||||
elif [[ ${COMP_WORDS[0]} == mdecrypt ]]; then
|
elif [[ ${words[0]} == mdecrypt ]]; then
|
||||||
_filedir nc
|
_filedir nc
|
||||||
else
|
else
|
||||||
decrypt=0
|
local i decrypt=0
|
||||||
for (( i=1; i < ${#COMP_WORDS[@]}-1; i++ )); do
|
for (( i=1; i < ${#words[@]}-1; i++ )); do
|
||||||
if [[ ${COMP_WORDS[i]} == -@(d|-decrypt) ]]; then
|
if [[ ${words[i]} == -@(d|-decrypt) ]]; then
|
||||||
_filedir nc
|
_filedir nc
|
||||||
decrypt=1
|
decrypt=1
|
||||||
break
|
break
|
||||||
|
@ -6,8 +6,8 @@ _mdadm_raid_level()
|
|||||||
{
|
{
|
||||||
local mode
|
local mode
|
||||||
|
|
||||||
for (( i=1; i < COMP_CWORD; i++ )); do
|
for (( i=1; i < cword; i++ )); do
|
||||||
case ${COMP_WORDS[i]} in
|
case ${words[i]} in
|
||||||
-C|--create)
|
-C|--create)
|
||||||
mode=create
|
mode=create
|
||||||
break
|
break
|
||||||
@ -35,9 +35,9 @@ _mdadm_raid_level()
|
|||||||
_mdadm_raid_layout()
|
_mdadm_raid_layout()
|
||||||
{
|
{
|
||||||
local level
|
local level
|
||||||
for (( i=1; i < COMP_CWORD; i++ )); do
|
for (( i=1; i < cword; i++ )); do
|
||||||
if [[ "${COMP_WORDS[i]}" == -@(l|-level) ]]; then
|
if [[ "${words[i]}" == -@(l|-level) ]]; then
|
||||||
level=${COMP_WORDS[i+1]}
|
level=${words[i+1]}
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@ -72,11 +72,10 @@ _mdadm_update_flag()
|
|||||||
|
|
||||||
_mdadm()
|
_mdadm()
|
||||||
{
|
{
|
||||||
local cur prev mode options split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -104,15 +103,16 @@ _mdadm()
|
|||||||
|
|
||||||
$split && return 0
|
$split && return 0
|
||||||
|
|
||||||
|
local options
|
||||||
options='--help --help-options --version --verbose --quiet \
|
options='--help --help-options --version --verbose --quiet \
|
||||||
--brief --force --config --scan --metadata --homehost'
|
--brief --force --config --scan --metadata --homehost'
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
if [[ $COMP_CWORD -eq 1 ]] ; then
|
if [[ $cword -eq 1 ]] ; then
|
||||||
COMPREPLY=( $( compgen -W "$options --assemble --build \
|
COMPREPLY=( $( compgen -W "$options --assemble --build \
|
||||||
--create --monitor --grow" -- "$cur" ) )
|
--create --monitor --grow" -- "$cur" ) )
|
||||||
else
|
else
|
||||||
case ${COMP_WORDS[COMP_CWORD-1]} in
|
case ${words[cword-1]} in
|
||||||
-A|--assemble)
|
-A|--assemble)
|
||||||
COMPREPLY=( $( compgen -W "$options --uuid \
|
COMPREPLY=( $( compgen -W "$options --uuid \
|
||||||
--super-minor --name --force --run \
|
--super-minor --name --force --run \
|
||||||
|
@ -4,11 +4,8 @@ have medusa || return
|
|||||||
|
|
||||||
_medusa()
|
_medusa()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
cur=`_get_cword`
|
|
||||||
prev=`_get_pword`
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-h)
|
-h)
|
||||||
|
@ -4,10 +4,8 @@ have minicom || return
|
|||||||
|
|
||||||
_minicom()
|
_minicom()
|
||||||
{
|
{
|
||||||
local cur prev confdir
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-a|-c)
|
-a|-c)
|
||||||
@ -32,6 +30,7 @@ _minicom()
|
|||||||
-c -S -d -p -C -T -7 -8' -- "$cur" ) )
|
-c -S -d -p -C -T -7 -8' -- "$cur" ) )
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
|
local confdir
|
||||||
[ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] \
|
[ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] \
|
||||||
&& confdir=/etc
|
&& confdir=/etc
|
||||||
[ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] \
|
[ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] \
|
||||||
|
@ -4,11 +4,10 @@ have mkinitrd || return
|
|||||||
|
|
||||||
_mkinitrd()
|
_mkinitrd()
|
||||||
{
|
{
|
||||||
local cur prev args split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
@ -36,6 +35,7 @@ _mkinitrd()
|
|||||||
--omit-lvm-modules --builtin --omit-dmraid --net-dev \
|
--omit-lvm-modules --builtin --omit-dmraid --net-dev \
|
||||||
--fstab --nocompress --dsdt --bootchart' -- "$cur" ) )
|
--fstab --nocompress --dsdt --bootchart' -- "$cur" ) )
|
||||||
else
|
else
|
||||||
|
local args
|
||||||
_count_args
|
_count_args
|
||||||
|
|
||||||
case $args in
|
case $args in
|
||||||
|
@ -6,10 +6,8 @@
|
|||||||
have rmmod &&
|
have rmmod &&
|
||||||
_rmmod()
|
_rmmod()
|
||||||
{
|
{
|
||||||
local cur
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur
|
|
||||||
|
|
||||||
_installed_modules "$cur"
|
_installed_modules "$cur"
|
||||||
return 0
|
return 0
|
||||||
@ -23,13 +21,11 @@ complete -F _rmmod rmmod
|
|||||||
have insmod || have modprobe || have modinfo &&
|
have insmod || have modprobe || have modinfo &&
|
||||||
_insmod()
|
_insmod()
|
||||||
{
|
{
|
||||||
local cur prev modpath
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
# behave like lsmod for modprobe -r
|
# behave like lsmod for modprobe -r
|
||||||
if [[ ${1##*/} == modprobe && "${COMP_WORDS[1]}" == -r ]]; then
|
if [[ ${1##*/} == modprobe && "${words[1]}" == -r ]]; then
|
||||||
_installed_modules "$cur"
|
_installed_modules "$cur"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -40,9 +36,9 @@ _insmod()
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $COMP_CWORD -gt 1 && "${COMP_WORDS[COMP_CWORD-1]}" != -* ]]; then
|
if [[ $cword -gt 1 && "${words[cword-1]}" != -* ]]; then
|
||||||
# do module parameter completion
|
# do module parameter completion
|
||||||
COMPREPLY=( $( compgen -W "$( /sbin/modinfo -p ${COMP_WORDS[1]} | \
|
COMPREPLY=( $( compgen -W "$( /sbin/modinfo -p ${words[1]} | \
|
||||||
cut -d: -f1 )" -- "$cur" ) )
|
cut -d: -f1 )" -- "$cur" ) )
|
||||||
else
|
else
|
||||||
_modules $(uname -r)
|
_modules $(uname -r)
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
have monodevelop &&
|
have monodevelop &&
|
||||||
_monodevelop()
|
_monodevelop()
|
||||||
{
|
{
|
||||||
local cur
|
local cur prev words cword
|
||||||
_get_comp_words_by_ref cur
|
_init_completion || return
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-? -help -help2 -ipc-tcp -newwindow -nologo \
|
COMPREPLY=( $( compgen -W '-? -help -help2 -ipc-tcp -newwindow -nologo \
|
||||||
@ -19,15 +19,14 @@ complete -F _monodevelop monodevelop
|
|||||||
have mdtool &&
|
have mdtool &&
|
||||||
_mdtool()
|
_mdtool()
|
||||||
{
|
{
|
||||||
local cur prev command i
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
COMPREPLY=()
|
local command i
|
||||||
|
|
||||||
_get_comp_words_by_ref cur prev
|
for (( i=0; i < ${#words[@]}-1; i++ )); do
|
||||||
|
if [[ ${words[i]} == @(build|generate-makefiles|setup) ]]; then
|
||||||
for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
|
command=${words[i]}
|
||||||
if [[ ${COMP_WORDS[i]} == @(build|generate-makefiles|setup) ]]; then
|
|
||||||
command=${COMP_WORDS[i]}
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -76,10 +76,10 @@ _linux_fstab()
|
|||||||
|
|
||||||
_mount()
|
_mount()
|
||||||
{
|
{
|
||||||
local cur sm host prev
|
local cur prev words cword
|
||||||
|
_init_completion -n : || return
|
||||||
|
|
||||||
COMPREPLY=()
|
local sm host
|
||||||
_get_comp_words_by_ref -n : cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-t|--types)
|
-t|--types)
|
||||||
@ -136,9 +136,8 @@ complete -F _mount -o default -o dirnames mount
|
|||||||
have umount &&
|
have umount &&
|
||||||
_umount()
|
_umount()
|
||||||
{
|
{
|
||||||
local cur
|
local cur prev words cword
|
||||||
_get_comp_words_by_ref cur
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
|
|
||||||
if [[ $OSTYPE == *linux* && -r /proc/mounts ]]; then
|
if [[ $OSTYPE == *linux* && -r /proc/mounts ]]; then
|
||||||
# Linux /proc/mounts is properly quoted. This is important when
|
# Linux /proc/mounts is properly quoted. This is important when
|
||||||
|
@ -12,11 +12,10 @@ _mplayer_options_list()
|
|||||||
|
|
||||||
_mplayer()
|
_mplayer()
|
||||||
{
|
{
|
||||||
local cmd cur prev i j k=0
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
COMPREPLY=()
|
local cmd=${words[0]} i j k=0
|
||||||
cmd=${COMP_WORDS[0]}
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile| \
|
-[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile| \
|
||||||
|
@ -4,12 +4,10 @@ have msynctool || return
|
|||||||
|
|
||||||
_msynctool()
|
_msynctool()
|
||||||
{
|
{
|
||||||
local cur prev anteprev
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
COMPREPLY=()
|
case $words in
|
||||||
_get_comp_words_by_ref cur prev anteprev
|
|
||||||
|
|
||||||
case $anteprev in
|
|
||||||
--configure)
|
--configure)
|
||||||
COMPREPLY=( $( compgen -W "$(msynctool --showgroup \
|
COMPREPLY=( $( compgen -W "$(msynctool --showgroup \
|
||||||
$prev | awk '/^Member/ {print $2}' | sed \
|
$prev | awk '/^Member/ {print $2}' | sed \
|
||||||
|
@ -4,10 +4,10 @@ have mtx || return
|
|||||||
|
|
||||||
_mtx()
|
_mtx()
|
||||||
{
|
{
|
||||||
local cur prev options tapes drives
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
|
|
||||||
COMPREPLY=()
|
local options tapes drives
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
options="-f nobarcode invert noattach --version inquiry noattach \
|
options="-f nobarcode invert noattach --version inquiry noattach \
|
||||||
inventory status load unload eepos first last next"
|
inventory status load unload eepos first last next"
|
||||||
@ -21,7 +21,7 @@ _mtx()
|
|||||||
drives=${drives//:Full}
|
drives=${drives//:Full}
|
||||||
drives=${drives//:Empty}
|
drives=${drives//:Empty}
|
||||||
|
|
||||||
if [ $COMP_CWORD -gt 1 ]; then
|
if [ $cword -gt 1 ]; then
|
||||||
case $prev in
|
case $prev in
|
||||||
load)
|
load)
|
||||||
COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "$tapes" -- "$cur" ) )
|
||||||
|
@ -3,10 +3,8 @@
|
|||||||
have munin-run &&
|
have munin-run &&
|
||||||
_munin_run()
|
_munin_run()
|
||||||
{
|
{
|
||||||
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
|
||||||
--config|--sconffile)
|
--config|--sconffile)
|
||||||
@ -32,10 +30,8 @@ complete -F _munin_run munin-run
|
|||||||
have munindoc &&
|
have munindoc &&
|
||||||
_munindoc()
|
_munindoc()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W '$( command ls /usr/share/munin/plugins )' \
|
COMPREPLY=( $( compgen -W '$( command ls /usr/share/munin/plugins )' \
|
||||||
-- "$cur" ) )
|
-- "$cur" ) )
|
||||||
@ -45,10 +41,8 @@ complete -F _munindoc munindoc
|
|||||||
have munin-update &&
|
have munin-update &&
|
||||||
_munin_update()
|
_munin_update()
|
||||||
{
|
{
|
||||||
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
|
||||||
--config)
|
--config)
|
||||||
@ -72,10 +66,8 @@ complete -F _munin_update munin-update
|
|||||||
have munin-node-configure &&
|
have munin-node-configure &&
|
||||||
_munin_node_configure()
|
_munin_node_configure()
|
||||||
{
|
{
|
||||||
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
|
||||||
--config)
|
--config)
|
||||||
|
@ -22,7 +22,7 @@ _muttaddr()
|
|||||||
_muttrc()
|
_muttrc()
|
||||||
{
|
{
|
||||||
# Search COMP_WORDS for '-F muttrc' or '-Fmuttrc' argument
|
# Search COMP_WORDS for '-F muttrc' or '-Fmuttrc' argument
|
||||||
set -- "${COMP_WORDS[@]}"
|
set -- "${words[@]}"
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
if [ "${1:0:2}" = -F ]; then
|
if [ "${1:0:2}" = -F ]; then
|
||||||
if [ ${#1} -gt 2 ]; then
|
if [ ${#1} -gt 2 ]; then
|
||||||
@ -76,7 +76,7 @@ _muttconffiles()
|
|||||||
# @param $1 (cur) Current word to complete
|
# @param $1 (cur) Current word to complete
|
||||||
_muttaliases()
|
_muttaliases()
|
||||||
{
|
{
|
||||||
local cur=$1 muttrc muttcmd=${COMP_WORDS[0]}
|
local cur=$1 muttrc muttcmd=${words[0]}
|
||||||
local -a conffiles aliases
|
local -a conffiles aliases
|
||||||
|
|
||||||
muttrc=$(_muttrc)
|
muttrc=$(_muttrc)
|
||||||
@ -94,7 +94,7 @@ _muttaliases()
|
|||||||
# @param $1 (cur) Current word to complete
|
# @param $1 (cur) Current word to complete
|
||||||
_muttquery()
|
_muttquery()
|
||||||
{
|
{
|
||||||
local cur=$1 querycmd muttcmd=${COMP_WORDS[0]}
|
local cur=$1 querycmd muttcmd=${words[0]}
|
||||||
local -a queryresults
|
local -a queryresults
|
||||||
|
|
||||||
querycmd="$( $muttcmd -Q query_command | sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|' )"
|
querycmd="$( $muttcmd -Q query_command | sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|' )"
|
||||||
@ -114,7 +114,7 @@ _muttquery()
|
|||||||
# @param $1 (cur) Current word to complete
|
# @param $1 (cur) Current word to complete
|
||||||
_muttfiledir()
|
_muttfiledir()
|
||||||
{
|
{
|
||||||
local cur=$1 folder muttrc spoolfile muttcmd=${COMP_WORDS[0]}
|
local cur=$1 folder muttrc spoolfile muttcmd=${words[0]}
|
||||||
|
|
||||||
muttrc=$(_muttrc)
|
muttrc=$(_muttrc)
|
||||||
if [[ $cur == [=+]* ]]; then
|
if [[ $cur == [=+]* ]]; then
|
||||||
@ -140,12 +140,8 @@ _muttfiledir()
|
|||||||
|
|
||||||
_mutt()
|
_mutt()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev words cword
|
||||||
_get_comp_words_by_ref -n =+! cur prev
|
_init_completion -n =+! || return
|
||||||
#cur=`_get_cword =+!`
|
|
||||||
#prev=`_get_pword =+!`
|
|
||||||
|
|
||||||
COMPREPLY=()
|
|
||||||
|
|
||||||
case $cur in
|
case $cur in
|
||||||
-*)
|
-*)
|
||||||
|
@ -4,11 +4,10 @@ have mysqladmin || return
|
|||||||
|
|
||||||
_mysqladmin()
|
_mysqladmin()
|
||||||
{
|
{
|
||||||
local cur prev split=false
|
local cur prev words cword
|
||||||
|
_init_completion || return
|
||||||
COMPREPLY=()
|
|
||||||
_get_comp_words_by_ref cur prev
|
|
||||||
|
|
||||||
|
local split=false
|
||||||
_split_longopt && split=true
|
_split_longopt && split=true
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user