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 / ipv6calc < prev    next >
Encoding:
Text File  |  2010-11-16  |  1.6 KB  |  58 lines

  1. have ipv6calc &&
  2. _ipv6calc()
  3. {
  4.     local cur prev split=false
  5.  
  6.     COMPREPLY=()
  7.     _get_comp_words_by_ref -n = cur prev
  8.     #cur=`_get_cword =`
  9.     #prev=`_get_pword`
  10.  
  11.     _split_longopt && split=true
  12.  
  13.     case "$prev" in
  14.         -d|--debug)
  15.             return 0
  16.             ;;
  17.         -I|--in|-O|--out|-A|--action)
  18.             # With ipv6calc < 0.73.0, -m does nothing here, so use sed instead.
  19.             COMPREPLY=( $( compgen -W "$( ipv6calc "$prev" -h 2>&1 | \
  20.                 sed -ne 's/^[[:space:]]\{1,\}\([^[:space:]:]\{1,\}\)[[:space:]]*:.*/\1/p' )" \
  21.                 -- "$cur" ) )
  22.             return 0
  23.             ;;
  24.         --db-geoip|--db-ip2location-ipv4|--db-ip2location-ipv6)
  25.             _filedir
  26.             return 0
  27.             ;;
  28.         --printstart|--printend)
  29.             return 0
  30.             ;;
  31.     esac
  32.  
  33.     $split && return 0
  34.  
  35.     if [[ "$cur" == -* ]]; then
  36.         COMPREPLY=( $( compgen -W '--help --debug --quiet --in \
  37.             --out --action --examples --showinfo --show_types \
  38.             --machine_readable --db-geoip --db-geoip-default \
  39.             --db-ip2location-ipv4 --db-ip2location-ipv6 \
  40.             --lowercase --uppercase --printprefix --printsuffix \
  41.             --maskprefix --masksuffix --printstart --printend \
  42.             --printcompressed --printuncompressed \
  43.             --printfulluncompressed --printmirrored' -- "$cur" ) )
  44.         return 0
  45.     fi
  46.  
  47.     return 0
  48. } &&
  49. complete -F _ipv6calc -o filenames ipv6calc
  50.  
  51. # Local variables:
  52. # mode: shell-script
  53. # sh-basic-offset: 4
  54. # sh-indent-comment: t
  55. # indent-tabs-mode: nil
  56. # End:
  57. # ex: ts=4 sw=4 et filetype=sh
  58.