/bash_completion.d/mc

http://github.com/brinkman83/bashrc · #! · 50 lines · 43 code · 7 blank · 0 comment · 0 complexity · a96e0604ea650ff46579096f49f0eb83 MD5 · raw file

  1. # bash completion for mc
  2. have mc &&
  3. _mc()
  4. {
  5. local cur prev split=false
  6. COMPREPLY=()
  7. cur=`_get_cword`
  8. prev=${COMP_WORDS[COMP_CWORD-1]}
  9. _split_longopt && split=true
  10. case "$prev" in
  11. -e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
  12. _filedir
  13. return 0
  14. ;;
  15. -C|--colors|-D|--debuglevel)
  16. # argument required but no completions available
  17. return 0
  18. ;;
  19. -h|--help|-V|--version)
  20. # all other arguments are noop with these
  21. return 0
  22. ;;
  23. esac
  24. $split && return 0
  25. if [[ "$cur" == -* ]]; then
  26. COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
  27. --color -C --colors -d --nomouse -e --edit -f \
  28. --datadir -k --resetsoft -l --ftplog -P --printwd \
  29. -s --slow -t --termcap -u --nosubshell -U --subshell \
  30. -v --view -V --version -x --xterm -D --debuglevel -h \
  31. --help' -- "$cur" ) )
  32. else
  33. _filedir -d
  34. fi
  35. } &&
  36. complete -F _mc $filenames mc
  37. # Local variables:
  38. # mode: shell-script
  39. # sh-basic-offset: 4
  40. # sh-indent-comment: t
  41. # indent-tabs-mode: nil
  42. # End:
  43. # ex: ts=4 sw=4 et filetype=sh