Use _split_longopt in mkinitrd.

This commit is contained in:
Ville Skyttä 2009-04-18 22:34:07 +03:00
parent 4dd5f087ae
commit 8a24a283a4
2 changed files with 17 additions and 27 deletions

View File

@ -35,7 +35,7 @@ bash-completion (1.x)
* Add _split_longopt() helper for improved handling of long options that
take arguments in both "--foo bar" and "--foo=bar" formats.
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
iptables, make, smartctl, and generic long option completion.
iptables, make, mkinitrd, smartctl, and generic long option completion.
* Add chown --from and --reference value completions.
* Add chgrp --reference value completion.
* Do not assume all --foo= options take filenames in generic long option

View File

@ -6,48 +6,38 @@
have mkinitrd &&
_mkinitrd()
{
local cur prev args
local cur prev args split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
# --name value style option
_split_longopt && split=true
case "$prev" in
--preload)
--@(preload|with|builtin))
_modules
return 0
;;
--@(fstab|dsdt))
_filedir
return 0
;;
--net-dev)
_available_interfaces
return 0
;;
esac
# --name=value style option
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
case "$prev" in
--@(with|builtin))
_modules
return 0
;;
--@(fstab|dsdt))
_filedir
return 0
;;
--net-dev)
_available_interfaces
return 0
;;
esac
fi
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '--version --help -v -f --preload \
--force-scsi-probe --omit-scsi-modules \
--omit-ide-modules --image-version --force-raid-probe \
--omit-raid-modules --with= --force-lvm-probe \
--omit-lvm-modules --builtin= --omit-dmraid --net-dev= \
--fstab= --nocompress --dsdt= --bootchart' -- $cur ) )
--omit-raid-modules --with --force-lvm-probe \
--omit-lvm-modules --builtin --omit-dmraid --net-dev \
--fstab --nocompress --dsdt --bootchart' -- $cur ) )
else
_count_args