Use _split_longopt with mc, other small mc option completion improvements.

This commit is contained in:
Ville Skyttä 2009-05-22 00:22:48 +03:00
parent cc66ec76f5
commit 402a0706a5
2 changed files with 19 additions and 19 deletions

View File

@ -38,8 +38,8 @@ 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,
cpio, iptables, make, mii-diag, mii-tool, mkinitrd, smartctl, and generic
long option completion (Alioth: #311398).
cpio, iptables, make, mc, mii-diag, mii-tool, mkinitrd, smartctl, and
generic long option completion (Alioth: #311398).
* 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,38 +6,38 @@
have mc &&
_mc()
{
local cur prev
local cur prev split=false
COMPREPLY=()
cur=`_get_cword`
prev=${COMP_WORDS[COMP_CWORD-1]}
# -name value style option
_split_longopt && split=true
case "$prev" in
-@(e|v|l|P))
-e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
_filedir
return 0
;;
-C|--colors|-D|--debuglevel)
# argument required but no completions available
return 0
;;
-h|--help|-V|--version)
# all other arguments are noop with these
return 0
;;
esac
# --name=value style option
if [[ "$cur" == *=* ]]; then
prev=${cur/=*/}
cur=${cur/*=/}
case "$prev" in
--@(edit|view|ftplog|printwd))
_filedir
return 0
;;
esac
fi
$split && return 0
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
--color -C --colors= -d --nomouse -e --edit= -f \
--datadir -k --resetsoft -l --ftplog= -P --printwd= \
--color -C --colors -d --nomouse -e --edit -f \
--datadir -k --resetsoft -l --ftplog -P --printwd \
-s --slow -t --termcap -u --nosubshell -U --subshell \
-v --view= -V --version -x --xterm -h --help' -- $cur ) )
-v --view -V --version -x --xterm -D --debuglevel -h \
--help' -- $cur ) )
else
_filedir -d
fi