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 / abook next >
Encoding:
Text File  |  2010-11-16  |  1.5 KB  |  65 lines

  1. # abook(1) completion
  2.  
  3. have abook &&
  4. _abook()
  5. {
  6.     local cur prev
  7.  
  8.     COMPREPLY=()
  9.     _get_comp_words_by_ref cur prev
  10.  
  11.     # abook only takes options, tabbing after command name adds a single
  12.     # dash (bash4)
  13.     [[ ${BASH_VERSINFO[0]} -ge 4 && $COMP_CWORD -eq 1 && -z "$cur" ]] &&
  14.     {
  15.         compopt -o nospace
  16.         COMPREPLY=( "-" )
  17.         return 0
  18.     }
  19.  
  20.     case $cur in
  21.         -*)
  22.             _longopt abook
  23.             return 0
  24.             ;;
  25.     esac
  26.  
  27.     case $prev in
  28.         --informat)
  29.             [ ${BASH_VERSINFO[0]} -ge 4 ] && compopt +o filenames
  30.             COMPREPLY=( $( compgen -W "$(abook --formats | \
  31.                 sed -n -e 's/^\t\([a-z]*\).*/\1/p' -e '/^$/q')" -- "$cur" ) )
  32.             return 0
  33.             ;;
  34.         --outformat)
  35.             [ ${BASH_VERSINFO[0]} -ge 4 ] && compopt +o filenames
  36.             COMPREPLY=( $( compgen -W "$(abook --formats | \
  37.                 sed -n -e '/^$/,$s/^\t\([a-z]*\).*/\1/p')" -- "$cur" ) )
  38.             return 0
  39.             ;;
  40.         --infile)
  41.             COMPREPLY=( $( compgen -W stdin -- "$cur" ) )
  42.             _filedir
  43.             return 0
  44.             ;;
  45.         --outfile)
  46.             COMPREPLY=( $( compgen -W stdout -- "$cur" ) )
  47.             _filedir
  48.             return 0
  49.             ;;
  50.         --config|--datafile)
  51.             _filedir
  52.             return 0
  53.             ;;
  54.     esac
  55. } &&
  56. complete -F _abook -o filenames abook
  57.  
  58. # Local variables:
  59. # mode: shell-script
  60. # sh-basic-offset: 4
  61. # sh-indent-comment: t
  62. # indent-tabs-mode: nil
  63. # End:
  64. # ex: ts=4 sw=4 et filetype=sh
  65.