/bash_completion_lib/complete -o default/aspell

http://github.com/brinkman83/bashrc · #! · 101 lines · 90 code · 11 blank · 0 comment · 0 complexity · ffca7088c14bd9c4307b12fbe229d26d MD5 · raw file

  1. # aspell(1) completion
  2. comp_include _filedir _get_cword
  3. _aspell_dictionary()
  4. {
  5. local datadir
  6. datadir=/usr/lib/aspell
  7. COMPREPLY=( $( command ls $datadir/*.@(multi|alias) ) )
  8. COMPREPLY=( ${COMPREPLY[@]%.@(multi|alias)} )
  9. COMPREPLY=( $( compgen -W '${COMPREPLY[@]#$datadir/}' -- $cur ) )
  10. } # _aspell_dictionary()
  11. _aspell()
  12. {
  13. local cur prev
  14. COMPREPLY=()
  15. cur=`_get_cword`
  16. prev=${COMP_WORDS[COMP_CWORD-1]}
  17. # --name value style option
  18. case "$prev" in
  19. @(-c|-p|check))
  20. _filedir
  21. return 0
  22. ;;
  23. @(dump|create|merge))
  24. COMPREPLY=( $( compgen -W 'master personal repl' -- $cur ) )
  25. return 0
  26. ;;
  27. -d)
  28. _aspell_dictionary
  29. return 0
  30. ;;
  31. esac
  32. # --name=value style option
  33. if [[ "$cur" == *=* ]]; then
  34. prev=${cur/=*/}
  35. cur=${cur/*=/}
  36. case "$prev" in
  37. --@(conf|personal|repl|per-conf))
  38. _filedir
  39. return 0
  40. ;;
  41. --@(conf-dir|data-dir|dict-dir|home-dir|local-data-dir|prefix))
  42. _filedir -d
  43. return 0
  44. ;;
  45. --master)
  46. _aspell_dictionary
  47. return 0
  48. ;;
  49. --mode)
  50. COMPREPLY=( $( compgen -W 'none url email sgml tex' -- $cur ) )
  51. return 0
  52. ;;
  53. --sug-mode)
  54. COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- $cur ) )
  55. return 0
  56. ;;
  57. --keymapping)
  58. COMPREPLY=( $( compgen -W 'aspell ispell' -- $cur ) )
  59. return 0
  60. ;;
  61. esac
  62. fi
  63. if [[ "$cur" == -* ]]; then
  64. COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \
  65. --encoding= --add-filter= --rem-filter= --mode= -e \
  66. -H -t --add-extra-dicts= --rem-extra-dicts= \
  67. --home-dir= -W --ignore= --ignore-accents \
  68. --dont-ignore-accents --ignore-case --dont-ignore-case \
  69. --ignore-repl --dont-ignore-repl --jargon= --keyboard= \
  70. --lang= --language-tag= --local-data-dir= -d --master= \
  71. --module= --add-module-search-order= \
  72. --rem-module-search-order= --per-conf= -p --personal= \
  73. --prefix= --repl= -C -B --run-together --dont-run-together \
  74. --run-together-limit= --run-together-min= --save-repl \
  75. --dont-save-repl --set-prefix --dont-set-prefix --size= \
  76. --spelling= --strip-accents --dont-strip-accents \
  77. --sug-mode= --add-word-list-path= --rem-word-list-path= \
  78. -b -x --backup -b|-x --dont-backup --reverse --dont-reverse \
  79. --time --dont-time --keymapping= --add-email-quote= \
  80. --rem-email-quote= --email-margin= --add-tex-command= \
  81. --rem-tex-command= --tex-check-comments \
  82. --dont-tex-check-comments --add-tex-extension= \
  83. --rem-tex-extension= --add-sgml-check= --rem-sgml-check= \
  84. --add-sgml-extension= --rem-sgml-extension=' -- $cur ) )
  85. else
  86. COMPREPLY=( $( compgen -W '-? help -c check -a pipe -l list \
  87. config config soundslike filter -v version dump \
  88. create merge' -- $cur ) )
  89. fi
  90. } # _aspell()