home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / bash_completion.d / aspell < prev    next >
Encoding:
Text File  |  2010-11-16  |  3.2 KB  |  97 lines

  1. # bash completion for aspell
  2.  
  3. have aspell && {
  4. _aspell_dictionary()
  5. {
  6.     local datadir
  7.     datadir=$( aspell config data-dir 2>/dev/null || echo /usr/lib/aspell )
  8.     # First, get aliases (dicts dump does not list them)
  9.     COMPREPLY=( $( command ls $datadir/*.alias 2>/dev/null ) )
  10.     COMPREPLY=( ${COMPREPLY[@]%.alias} )
  11.     COMPREPLY=( ${COMPREPLY[@]#$datadir/} )
  12.     # Then, add the canonical dicts
  13.     COMPREPLY=( "${COMPREPLY[@]}" $( aspell dicts 2>/dev/null ) )
  14.     COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
  15. }
  16.  
  17. _aspell()
  18. {
  19.     local cur prev split=false
  20.  
  21.     COMPREPLY=()
  22.     _get_comp_words_by_ref cur prev
  23.  
  24.     _split_longopt && split=true
  25.  
  26.     case $prev in
  27.         -c|-p|check|--conf|--personal|--repl|--per-conf)
  28.             _filedir
  29.             return 0
  30.             ;;
  31.         --conf-dir|--data-dir|--dict-dir|--home-dir|--local-data-dir|--prefix)
  32.             _filedir -d
  33.             return 0
  34.             ;;
  35.         dump|create|merge)
  36.             COMPREPLY=( $( compgen -W 'master personal repl' -- "$cur" ) )
  37.             return 0
  38.             ;;
  39.         --mode)
  40.             COMPREPLY=( $( compgen -W 'none url email sgml tex' -- "$cur" ) )
  41.             return 0
  42.             ;;
  43.         --sug-mode)
  44.             COMPREPLY=( $( compgen -W 'ultra fast normal bad-speller' -- "$cur" ) )
  45.             return 0
  46.             ;;
  47.         --keymapping)
  48.             COMPREPLY=( $( compgen -W 'aspell ispell' -- "$cur" ) )
  49.             return 0
  50.             ;;
  51.         -d|--master)
  52.             _aspell_dictionary
  53.             return 0
  54.             ;;
  55.     esac
  56.  
  57.     $split && return 0
  58.  
  59.     if [[ "$cur" == -* ]]; then
  60.         COMPREPLY=( $( compgen -W '--conf --conf-dir --data-dir --dict-dir \
  61.             --encoding --add-filter --rem-filter --mode \
  62.             --add-extra-dicts --rem-extra-dicts \
  63.             --home-dir --ignore --ignore-accents \
  64.             --dont-ignore-accents --ignore-case --dont-ignore-case \
  65.             --ignore-repl --dont-ignore-repl --jargon --keyboard \
  66.             --lang --language-tag --local-data-dir --master \
  67.             --module --add-module-search-order \
  68.             --rem-module-search-order --per-conf --personal \
  69.             --prefix --repl --run-together --dont-run-together \
  70.             --run-together-limit --run-together-min --save-repl \
  71.             --dont-save-repl --set-prefix --dont-set-prefix --size \
  72.             --spelling --strip-accents --dont-strip-accents \
  73.             --sug-mode --add-word-list-path --rem-word-list-path \
  74.             --backup --dont-backup --reverse --dont-reverse \
  75.             --time --dont-time --keymapping --add-email-quote \
  76.             --rem-email-quote --email-margin --add-tex-command \
  77.             --rem-tex-command --tex-check-comments \
  78.             --dont-tex-check-comments --add-tex-extension \
  79.             --rem-tex-extension --add-sgml-check --rem-sgml-check \
  80.             --add-sgml-extension --rem-sgml-extension' -- "$cur" ) )
  81.     else
  82.         COMPREPLY=( $( compgen -W 'usage help check pipe list \
  83.             config soundslike filter version dump create merge' -- "$cur" ) )
  84.     fi
  85.  
  86. }
  87. complete -F _aspell -o filenames aspell
  88. }
  89.  
  90. # Local variables:
  91. # mode: shell-script
  92. # sh-basic-offset: 4
  93. # sh-indent-comment: t
  94. # indent-tabs-mode: nil
  95. # End:
  96. # ex: ts=4 sw=4 et filetype=sh
  97.