[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 402a0706a586c831449a122bda6aaf5fee125a94
Ville Skyttä
ville.skytta at iki.fi
Thu May 21 21:23:01 UTC 2009
The following commit has been merged in the master branch:
commit 402a0706a586c831449a122bda6aaf5fee125a94
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Fri May 22 00:22:48 2009 +0300
Use _split_longopt with mc, other small mc option completion improvements.
diff --git a/CHANGES b/CHANGES
index 8d11034..2964d88 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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
diff --git a/contrib/mc b/contrib/mc
index 4c9fc2d..96de7fb 100644
--- a/contrib/mc
+++ b/contrib/mc
@@ -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
--
bash-completion
More information about the Bash-completion-commits
mailing list