_init_completion: Add -s for splitting long options, use it in completions.

This commit is contained in:
Ville Skyttä 2011-05-01 22:18:40 +03:00
parent 41ce815827
commit a54857cd05
46 changed files with 186 additions and 426 deletions

View File

@ -670,13 +670,15 @@ _split_longopt()
# Initialize completion and deal with redirections: do file completion where
# appropriate, and adjust prev, words, and cword as if no redirections exist
# so that completions do not need to deal with them. Before calling this
# function, make sure cur, prev, words, and cword are local.
# function, make sure cur, prev, words, and cword are local, ditto split if
# you use -s.
#
# Options:
# -n EXCLUDE Passed to _get_comp_words_by_ref -n with redirection chars
# -e XSPEC Passed to _filedir as first arg for stderr redirections
# -o XSPEC Passed to _filedir as first arg for other output redirections
# -i XSPEC Passed to _filedir as first arg for stdin redirections
# -s Split long options with _split_longopt, implies -n =
# @return True (0) if completion needs further processing,
# False (> 0) if tilde is followed by a valid username, completions
# are put in COMPREPLY and no further processing is necessary.
@ -685,12 +687,13 @@ _init_completion()
{
local exclude flag outx errx inx OPTIND=1
while getopts "n:e:o:i:" flag "$@"; do
while getopts "n:e:o:i:s" flag "$@"; do
case $flag in
n) exclude=$OPTARG ;;
n) exclude+=$OPTARG ;;
e) errx=$OPTARG ;;
o) outx=$OPTARG ;;
i) inx=$OPTARG ;;
s) split=false ; exclude+== ;;
esac
done
@ -739,6 +742,8 @@ _init_completion()
done
[[ $cword -ge 1 ]] && prev=${words[cword-1]} || prev=
[[ $split ]] && _split_longopt && split=true
return 0
}
@ -1639,11 +1644,8 @@ _complete_as_root()
_longopt()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case "${prev,,}" in
--*dir*)

View File

@ -7,8 +7,8 @@ have mock || return
_mock()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
local plugins='tmpfs root_cache yum_cache bind_mount ccache'
local cfgdir=/etc/mock count=0 i
@ -23,9 +23,6 @@ _mock()
count=$((++count))
done
local split=false
_split_longopt && split=true
case $prev in
-h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\
--uniqueext|--rpmbuild_timeout|--sources|--cwd)

View File

@ -37,8 +37,8 @@ _yum_plugins()
_yum()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
local special i
for (( i=0; i < ${#words[@]}-1; i++ )); do
@ -75,9 +75,6 @@ _yum()
esac
fi
local split=false
_split_longopt && split=true
case $prev in
list)
COMPREPLY=( $( compgen -W 'all available updates \

View File

@ -7,13 +7,16 @@ have repomanage || return
_repomanage()
{
local cur prev words cword
_init_completion || return
local cur prev words cword split
_init_completion -s || return
[[ "$prev" == -@(h|-help|k|-keep) ]] && return 0
$split && return
if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
else
_filedir -d
fi

View File

@ -17,11 +17,8 @@ _aspell_dictionary()
_aspell()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-c|-p|check|--conf|--personal|--repl|--per-conf)

View File

@ -3,11 +3,8 @@
have autoconf &&
_autoconf()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case "$prev" in
--help|-h|--version|-V|--trace|-t)
@ -43,11 +40,8 @@ complete -F _autoconf autoconf
have autoreconf || have autoheader &&
_autoreconf()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case "$prev" in
--help|-h|--version|-V)
@ -84,11 +78,8 @@ complete -F _autoreconf autoreconf autoheader
have autoscan || have autoupdate &&
_autoscan()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case "$prev" in
--help|-h|--version|-V)

View File

@ -3,11 +3,8 @@
have automake &&
_automake()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case "$prev" in
--help|--version)
@ -39,11 +36,8 @@ complete -F _automake automake automake-1.11
have aclocal &&
_aclocal()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case "$prev" in
--help|--print-ac-dir|--version)

View File

@ -31,11 +31,8 @@ _bluetooth_packet_types()
_hcitool()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-i)
@ -113,11 +110,8 @@ complete -F _hcitool hcitool
_sdptool()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
--bdaddr)

View File

@ -4,11 +4,8 @@ have chkconfig || return
_chkconfig()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
--level=[1-6]|[1-6]|--list|--add|--del|--override)

View File

@ -4,11 +4,8 @@
_configure()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
--*prefix|--*dir)

View File

@ -5,12 +5,9 @@
have chown &&
_chown()
{
local cur prev words cword
local cur prev words cword split
# Don't treat user:group as separate words.
_init_completion -n := || return
local split=false
_split_longopt && split=true
_init_completion -s -n : || return
case "$prev" in
--from)
@ -55,14 +52,11 @@ complete -F _chown chown
have chgrp &&
_chgrp()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
cur=${cur//\\\\/}
local split=false
_split_longopt && split=true
if [[ "$prev" == --reference ]]; then
_filedir
return 0
@ -116,11 +110,8 @@ complete -F _id id
have mktemp &&
_mktemp()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case "$prev" in
--help|--version|--suffix)

View File

@ -9,11 +9,8 @@ _cpio_format()
_cpio()
{
local cur prev words cword
_init_completion -n := || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s -n : || return
# --name value style option
case $prev in

View File

@ -4,11 +4,8 @@ have cppcheck || return
_cppcheck()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
--append|--exitcode-suppressions|--file-list|--rule-file|\

View File

@ -16,11 +16,8 @@ _cryptsetup_device()
_cryptsetup()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
--key-file|--master-key-file|--header-backup-file|-d)

View File

@ -20,13 +20,11 @@ _comp_dpkg_installed_packages()
#
_dpkg()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
_expand || return 0
_split_longopt
local i=$cword
# find the last option flag

View File

@ -4,11 +4,8 @@ have getent || return
_getent()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
local i db
for (( i=1; i < cword; i++ )); do

View File

@ -23,12 +23,10 @@ _heimdal_encodings()
_ktutil()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
local command options split=false
_split_longopt && split=true
local command options
case $prev in
-p|--principal)

View File

@ -4,11 +4,8 @@ have iconv || return
_iconv()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-'?'|--help|--usage|-V|--version|--unicode-subst|--byte-subst|\

View File

@ -4,14 +4,11 @@ have info || return
_info()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
_expand || return 0
local split=false
_split_longopt && split=true
# default completion if parameter looks like a path
if [[ "$cur" == @(*/|[.~])* ]]; then
_filedir

View File

@ -4,8 +4,8 @@ have iptables || return
_iptables()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
local table chain='s/^Chain \([^ ]\{1,\}\).*$/\1/p'
@ -17,8 +17,6 @@ _iptables()
table="-t mangle"
fi
_split_longopt
case $prev in
-*[AIDRPFXLZ])
COMPREPLY=( $( compgen -W '`iptables $table -nL | \

View File

@ -2,11 +2,8 @@ have ipv6calc || return
_ipv6calc()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case "$prev" in
-d|--debug)

View File

@ -319,11 +319,8 @@ complete -F _javac javac
have pack200 &&
_pack200()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-S|--segment-limit|-P|--pass-file|-C|--class-attribute|\
@ -395,11 +392,8 @@ complete -F _pack200 pack200
have unpack200 &&
_unpack200()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
'-?'|-h|--help|-V|--version|-J)

View File

@ -23,11 +23,8 @@ complete -F _list_lists list_lists
have add_members &&
_add_members()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-r|-d|--regular-members-file|--digest-members-file)
@ -56,11 +53,8 @@ complete -F _add_members add_members
have remove_members &&
_remove_members()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-f|--file)
@ -84,11 +78,8 @@ complete -F _remove_members remove_members
have find_member &&
_find_member()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-l|-x|--listname|--exclude)
@ -110,11 +101,8 @@ complete -F _find_member find_member
have clone_member &&
_clone_member()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-l|--listname)
@ -136,11 +124,8 @@ complete -F _clone_member clone_member
have sync_members &&
_sync_members()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-w|-g|-d|--welcome-msg|--goodbye-msg|--digest)
@ -214,11 +199,8 @@ complete -F _list_owners list_owners
have list_members &&
_list_members()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-o|--output)
@ -251,11 +233,8 @@ complete -F _list_members list_members
have change_pw &&
_change_pw()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-l|--listname)
@ -323,11 +302,8 @@ complete -F _rmlist rmlist
have config_list &&
_config_list()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-i|-o|--inputfile|--outputfile)
@ -353,11 +329,8 @@ complete -F _config_list config_list
have arch && have mailmanctl &&
_arch()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-w|-g|-d|--welcome-msg|--goodbye-msg|--digest)
@ -412,11 +385,8 @@ complete -F _cleanarch cleanarch
have inject &&
_inject()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-l|--listname)
@ -509,10 +479,10 @@ complete -F _mmsitepass mmsitepass
have qrunner &&
_qrunner()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
_split_longopt && return 0
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--runner --once \

View File

@ -4,12 +4,10 @@ have make || have gmake || have gnumake || have pmake || return
_make()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
local file makef makef_dir="." makef_inc i split=false
_split_longopt && split=true
local file makef makef_dir="." makef_inc i
case $prev in
-f|-o|-W|--file|--makefile|--old-file|--new-file|--assume-old|--assume-new|--what-if)

View File

@ -3,11 +3,8 @@
[[ $USERLAND == GNU || $UNAME == @(Darwin|FreeBSD|SunOS|Cygwin|OpenBSD) ]] &&
_man()
{
local cur prev words cword
_init_completion -n := || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s -n : || return
local i sect manpath manext mansect uname

View File

@ -4,11 +4,8 @@ have mc || return
_mc()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-e|--edit|-v|--view|-l|--ftplog|-P|--printwd)

View File

@ -72,11 +72,8 @@ _mdadm_update_flag()
_mdadm()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-c|--config|-b|--bitmap|--backup-file)

View File

@ -4,11 +4,8 @@ have mkinitrd || return
_mkinitrd()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
--preload|--with|--builtin)

View File

@ -4,11 +4,8 @@ have mysqladmin || return
_mysqladmin()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-u|--user)

View File

@ -3,11 +3,8 @@
have mii-tool &&
_mii_tool()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-F|--force)
@ -35,11 +32,8 @@ complete -F _mii_tool -o default mii-tool
have mii-diag &&
_mii_diag()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-F|-A|--advertise|--fixed-speed)

View File

@ -4,11 +4,8 @@ have iscsiadm || return
_iscsiadm()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-m|--mode)

View File

@ -4,11 +4,8 @@ have pkg-config || return
_pkg_config()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
--variable|--define-variable|--atleast-version|--atleast-pkgconfig-version| \

View File

@ -22,11 +22,8 @@ _pg_users()
#
_createdb()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-h|--host)
@ -61,11 +58,8 @@ complete -F _createdb -o default createdb
#
_dropdb()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-h|--host)
@ -96,11 +90,8 @@ complete -F _dropdb -o default dropdb
#
_psql()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-h|--host)

View File

@ -33,11 +33,8 @@ _filesystems()
_quota()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-F|--format)
@ -61,11 +58,8 @@ complete -F _quota -o default quota
_setquota()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-F|--format)
@ -99,11 +93,8 @@ complete -F _setquota -o default setquota
_edquota()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-F|--format)
@ -130,11 +121,8 @@ complete -F _edquota -o default edquota
_quotacheck()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-F|--format)
@ -158,11 +146,8 @@ complete -F _quotacheck -o default quotacheck
_repquota()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-F|--format)
@ -186,11 +171,8 @@ complete -F _repquota -o default repquota
_quotaon()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-F|--format)
@ -212,11 +194,8 @@ complete -F _quotaon -o default quotaon
_quotaoff()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-F|--format)

View File

@ -87,11 +87,8 @@ complete -F _reportbug reportbug
have querybts &&
_querybts()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-B|--bts)

View File

@ -39,8 +39,8 @@ _rpm_macros()
#
_rpm()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
if [ $cword -eq 1 ]; then
# first parameter on line
@ -60,9 +60,6 @@ _rpm()
return 0
fi
local split=false
_split_longopt && split=true
case $prev in
--dbpath|--excludepath|--prefix|--relocate|--root)
_filedir -d
@ -233,11 +230,8 @@ complete -F _rpm rpm
_rpmbuild()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
local rpm="${1%build*}"
[[ $rpm == $1 ]] || ! type $rpm &>/dev/null && rpm=

View File

@ -4,14 +4,11 @@ have rsync || return
_rsync()
{
local cur prev words cword
_init_completion -n := || return
local cur prev words cword split
_init_completion -s -n : || return
_expand || return 0
local split=false
_split_longopt && split=true
case $prev in
--config|--password-file|--include-from|--exclude-from|--files-from|\
--log-file|--write-batch|--only-write-batch|--read-batch)

View File

@ -4,11 +4,8 @@ have rtcwake || return
_rtcwake()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case "$prev" in
--help|-h|--version|-V|--seconds|-s|--time|-t)

View File

@ -30,11 +30,8 @@ _samba_debuglevel()
_smbclient()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-R)
@ -95,11 +92,8 @@ complete -F _smbclient smbclient
_smbget()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-o|-f|--outputfile|--rcfile)
@ -126,11 +120,8 @@ complete -F _smbget smbget
_smbcacls()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-s)
@ -158,11 +149,8 @@ complete -F _smbcacls smbcacls
_smbcquotas()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-s|-A|--authentication-file)
@ -249,11 +237,8 @@ complete -F _smbtar smbtar
_smbtree()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-s|-A|--authentication-file)

View File

@ -3,11 +3,8 @@
have useradd &&
_useradd()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
# TODO: if -o/--non-unique is given, could complete on existing uids
# with -u/--uid
@ -49,11 +46,8 @@ complete -F _useradd useradd
have usermod &&
_usermod()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
# TODO: if -o/--non-unique is given, could complete on existing uids
# with -u/--uid
@ -109,11 +103,8 @@ complete -F _userdel userdel
have chage &&
_chage()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-d|--lastday|-E|--expiredate|-h|--help|-I|--inactive|-m|--mindays|\
@ -158,11 +149,8 @@ complete -F _passwd passwd
have chpasswd &&
_chpasswd()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-c|--crypt)
@ -187,11 +175,8 @@ complete -F _chpasswd chpasswd
have newusers &&
_newusers()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-c|--crypt)
@ -233,11 +218,8 @@ complete -F _pwck pwck
have groupadd &&
_groupadd()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
# TODO: if -o/--non-unique is given, could complete on existing gids
# with -g/--gid
@ -260,11 +242,8 @@ complete -F _groupadd groupadd
have groupmod &&
_groupmod()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
# TODO: if -o/--non-unique is given, could complete on existing gids
# with -g/--gid
@ -386,11 +365,8 @@ complete -F _vipw vipw vigr
have faillog &&
_faillog()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-h|--help|-l|--lock-time|-m|--maximum|-t|--time)
@ -414,11 +390,8 @@ complete -F _faillog faillog
have lastlog &&
_lastlog()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-b|--before|-h|--help|-t|--time)

View File

@ -93,11 +93,8 @@ _smartctl_drivedb()
_smartctl()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
-q|--quietmode)

View File

@ -4,11 +4,8 @@ have sysbench || return
_sysbench()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
--num-threads|--max-requests|--max-time|--thread-stack-size| \

View File

@ -4,8 +4,8 @@ have tar || return
_tar()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
local ext regex tar untar
@ -57,9 +57,6 @@ _tar()
;;
esac
local split=false
_split_longopt && split=true
case $prev in
*$ext)
# complete on files in tar file

View File

@ -4,11 +4,8 @@ have wol || return
_wol()
{
local cur prev words cword
_init_completion -n := || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s -n : || return
case $prev in
-V|--version|--help|-p|--port|--passwd|-w|--wait)

View File

@ -4,11 +4,8 @@ have wvdial || return
_wvdial()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
case $prev in
--config)

View File

@ -3,11 +3,8 @@
have xz || have pxz &&
_xz()
{
local cur prev words cword
_init_completion -n = || return
local split=false
_split_longopt && split=true
local cur prev words cword split
_init_completion -s || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help ) {-1..-9}' \
@ -60,17 +57,14 @@ complete -F _xz xz pxz
have xzdec &&
_xzdec()
{
local cur prev words cword
_init_completion -n = || return
local cur prev words cword split
_init_completion -s || return
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
fi
local split=false
_split_longopt && split=true
case $prev in
-M|--memory)
# argument required but no completions available