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

  1. # bash completion for rpcdebug
  2.  
  3. have rpcdebug && {
  4. _rpcdebug_flags()
  5. {
  6.  
  7.     local i module
  8.  
  9.     for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
  10.         if [[ ${COMP_WORDS[i]} == -m ]]; then
  11.             module=${COMP_WORDS[i+1]}
  12.         fi
  13.     done
  14.  
  15.     if [ -n "$module" ]; then
  16.         COMPREPLY=( $( compgen -W "$(rpcdebug -vh 2>&1 \
  17.             | command grep '^'$module' '\
  18.             | awk '{$1 = ""; print $0}')" -- "$cur" ) )
  19.     fi
  20. }
  21.  
  22. _rpcdebug()
  23. {
  24.     local cur prev
  25.  
  26.     COMPREPLY=()
  27.     _get_comp_words_by_ref cur prev
  28.  
  29.     case $prev in
  30.         -s)
  31.             _rpcdebug_flags
  32.             return 0
  33.             ;;
  34.         -c)
  35.             _rpcdebug_flags
  36.             return 0
  37.             ;;
  38.         -m)
  39.             COMPREPLY=( $( compgen -W 'rpc nfs nfsd nlm' -- "$cur" ) )
  40.             return 0
  41.             ;;
  42.     esac
  43.  
  44.     if [[ "$cur" == -* ]]; then
  45.         COMPREPLY=( $( compgen -W '-v -h -m -s -c' -- "$cur" ) )
  46.     fi
  47. }
  48. complete -F _rpcdebug rpcdebug
  49. }
  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.