summaryrefslogtreecommitdiff
path: root/completions/mc
diff options
context:
space:
mode:
Diffstat (limited to 'completions/mc')
-rw-r--r--completions/mc26
1 files changed, 7 insertions, 19 deletions
diff --git a/completions/mc b/completions/mc
index 09e9eabe..f3065793 100644
--- a/completions/mc
+++ b/completions/mc
@@ -1,14 +1,9 @@
-# bash completion for mc
+# bash completion for mc -*- shell-script -*-
-have mc &&
_mc()
{
- local cur prev split=false
-
- COMPREPLY=()
- _get_comp_words_by_ref cur prev
-
- _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)
@@ -19,7 +14,7 @@ _mc()
# argument required but no completions available
return 0
;;
- -h|--help|-V|--version)
+ -h|--help|--help-*|-V|--version)
# all other arguments are noop with these
return 0
;;
@@ -28,20 +23,13 @@ _mc()
$split && return 0
if [[ "$cur" == -* ]]; then
- COMPREPLY=( $( compgen -W '--stickchars --nocolor --color --colors \
- --nomouse --edit --datadir --resetsoft --ftplog --printwd --slow \
- --termcap --nosubshell --subshell --view --version --xterm \
- --debuglevel --help' -- "$cur" ) )
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \
+ -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
else
_filedir -d
fi
} &&
complete -F _mc mc
-# Local variables:
-# mode: shell-script
-# sh-basic-offset: 4
-# sh-indent-comment: t
-# indent-tabs-mode: nil
-# End:
# ex: ts=4 sw=4 et filetype=sh