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

  1. # Perforce completion by Frank Cusack <frank@google.com>
  2.  
  3. have p4 &&
  4. _p4()
  5. {
  6.     local cur prev preprev p4commands p4filetypes
  7.  
  8.     COMPREPLY=()
  9.     _get_comp_words_by_ref cur prev preprev
  10.  
  11.     # rename isn't really a command
  12.     p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )"
  13.     p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \
  14.         uresource uxbinary xbinary xltext xtempobj xtext \
  15.         text binary resource"
  16.  
  17.     if [ $COMP_CWORD -eq 1 ]; then
  18.         COMPREPLY=( $( compgen -W "$p4commands" -- "$cur" ) )
  19.     elif [ $COMP_CWORD -eq 2 ]; then
  20.         case $prev in
  21.             help)
  22.                 COMPREPLY=( $( compgen -W "simple commands \
  23.                     environment filetypes jobview revisions \
  24.                     usage views $p4commands" -- "$cur" ) )
  25.                 ;;
  26.             admin)
  27.                 COMPREPLY=( $( compgen -W "checkpoint stop" -- "$cur" ) )
  28.                 ;;
  29.             *)
  30.                 ;;
  31.         esac
  32.     elif [ $COMP_CWORD -gt 2 ]; then
  33.         case $prev in
  34.             -t)
  35.                 case $preprev in
  36.                     add|edit|reopen)
  37.                         COMPREPLY=( $( compgen -W "$p4filetypes" -- "$cur") )
  38.                         ;;
  39.                     *)
  40.                         ;;
  41.                 esac
  42.                 ;;
  43.             *)
  44.                 ;;
  45.         esac
  46.     fi
  47.  
  48.     return 0
  49. } &&
  50. complete -F _p4 -o default p4 g4
  51.  
  52. # Local variables:
  53. # mode: shell-script
  54. # sh-basic-offset: 4
  55. # sh-indent-comment: t
  56. # indent-tabs-mode: nil
  57. # End:
  58. # ex: ts=4 sw=4 et filetype=sh
  59.