/bash_completion_lib/complete -o filenames/mc

http://github.com/brinkman83/bashrc · #! · 44 lines · 36 code · 8 blank · 0 comment · 0 complexity · 4dfdbb314d331863daef27d45f594dd7 MD5 · raw file

  1. # mc(1) completion
  2. comp_include _filedir _get_cword
  3. _mc()
  4. {
  5. local cur prev
  6. COMPREPLY=()
  7. cur=`_get_cword`
  8. prev=${COMP_WORDS[COMP_CWORD-1]}
  9. # -name value style option
  10. case "$prev" in
  11. -@(e|v|l|P))
  12. _filedir
  13. return 0
  14. ;;
  15. esac
  16. # --name=value style option
  17. if [[ "$cur" == *=* ]]; then
  18. prev=${cur/=*/}
  19. cur=${cur/*=/}
  20. case "$prev" in
  21. --@(edit|view|ftplog|printwd))
  22. _filedir
  23. return 0
  24. ;;
  25. esac
  26. fi
  27. if [[ "$cur" == -* ]]; then
  28. COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
  29. --color -C --colors= -d --nomouse -e --edit= -f \
  30. --datadir -k --resetsoft -l --ftplog= -P --printwd= \
  31. -s --slow -t --termcap -u --nosubshell -U --subshell \
  32. -v --view= -V --version -x --xterm -h --help' -- $cur ) )
  33. else
  34. _filedir -d
  35. fi
  36. } # _mc()