Use _split_longopt with mc, other small mc option completion improvements.
This commit is contained in:
parent
cc66ec76f5
commit
402a0706a5
4
CHANGES
4
CHANGES
@ -38,8 +38,8 @@ bash-completion (1.x)
|
|||||||
* Add _split_longopt() helper for improved handling of long options that
|
* Add _split_longopt() helper for improved handling of long options that
|
||||||
take arguments in both "--foo bar" and "--foo=bar" formats.
|
take arguments in both "--foo bar" and "--foo=bar" formats.
|
||||||
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
|
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
|
||||||
cpio, iptables, make, mii-diag, mii-tool, mkinitrd, smartctl, and generic
|
cpio, iptables, make, mc, mii-diag, mii-tool, mkinitrd, smartctl, and
|
||||||
long option completion (Alioth: #311398).
|
generic long option completion (Alioth: #311398).
|
||||||
* Add chown --from and --reference value completions.
|
* Add chown --from and --reference value completions.
|
||||||
* Add chgrp --reference value completion.
|
* Add chgrp --reference value completion.
|
||||||
* Do not assume all --foo= options take filenames in generic long option
|
* Do not assume all --foo= options take filenames in generic long option
|
||||||
|
34
contrib/mc
34
contrib/mc
@ -6,38 +6,38 @@
|
|||||||
have mc &&
|
have mc &&
|
||||||
_mc()
|
_mc()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev split=false
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=`_get_cword`
|
cur=`_get_cword`
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
# -name value style option
|
_split_longopt && split=true
|
||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
-@(e|v|l|P))
|
-e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
|
||||||
_filedir
|
_filedir
|
||||||
return 0
|
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
|
esac
|
||||||
|
|
||||||
# --name=value style option
|
$split && return 0
|
||||||
if [[ "$cur" == *=* ]]; then
|
|
||||||
prev=${cur/=*/}
|
|
||||||
cur=${cur/*=/}
|
|
||||||
case "$prev" in
|
|
||||||
--@(edit|view|ftplog|printwd))
|
|
||||||
_filedir
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
|
COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
|
||||||
--color -C --colors= -d --nomouse -e --edit= -f \
|
--color -C --colors -d --nomouse -e --edit -f \
|
||||||
--datadir -k --resetsoft -l --ftplog= -P --printwd= \
|
--datadir -k --resetsoft -l --ftplog -P --printwd \
|
||||||
-s --slow -t --termcap -u --nosubshell -U --subshell \
|
-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
|
else
|
||||||
_filedir -d
|
_filedir -d
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user