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 / initramfs-tools < prev    next >
Encoding:
Text File  |  2010-06-17  |  713 b   |  27 lines

  1. # update-initramfs(8) completion
  2.  
  3. _update_initramfs()
  4. {
  5.     local cur prev valid_options
  6.  
  7.     # TODO: this can be "_get_comp_words_by_ref cur prev" once
  8.     # bash-completion >= 1.2 is available, see #537139
  9.     cur=$(_get_cword)
  10.     prev=${COMP_WORDS[COMP_CWORD-1]}
  11.  
  12.     # The only option that takes an argument is -k
  13.     if [[ "$prev" == '-k' ]]; then
  14.         # Complete with kernel versions
  15.         _kernel_versions
  16.         COMPREPLY=( $( compgen -W '${COMPREPLY[@]} all' -- "$cur" ) )
  17.         return;
  18.     fi
  19.  
  20.     # Complete with available options (obtained from -h)
  21.     valid_options=$( update-initramfs -h 2>&1 | \
  22.         sed -e '/^ -/!d;s/^ \(-\w\+\).*/\1/' )
  23.     COMPREPLY=( $( compgen -W "$valid_options" -- $cur ) )
  24. }
  25.  
  26. complete -F _update_initramfs update-initramfs
  27.