ip1981

Untitled

Jan 2nd, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.32 KB | None | 0 0
  1. _bootadm () {
  2.     local cur prev opts line
  3.     COMPREPLY=()
  4.  
  5.     cur=${COMP_WORDS[COMP_CWORD]}
  6.     prev="${COMP_WORDS[COMP_CWORD-1]}"
  7.     line="${COMP_LINE}"
  8.  
  9.     if [[ ${COMP_CWORD} -eq 1 ]]; then
  10.         COMPREPLY=( $(compgen -W "update-archive list-archive set-menu list-menu" -- $cur) )
  11.         return
  12.     fi
  13.  
  14.     case "$prev" in
  15.     -R)
  16.         _cd
  17.         return;;
  18.     -p)
  19.         COMPREPLY=( $(compgen -W "i86pc sun4v sun4u" -- $cur) )
  20.         return;;
  21.     list-menu)
  22.         COMPREPLY=( $(compgen -W "-R" -- $cur) )
  23.         return;;
  24.     esac
  25.  
  26.     case "$line" in
  27.     *update-archive*-R*)
  28.         COMPREPLY=( $(compgen -W "-v -n -f -F -p" -- $cur) )
  29.         ;;
  30.     *update-archive*)
  31.         COMPREPLY=( $(compgen -W "-v -n -f -F -R" -- $cur) )
  32.         ;;
  33.     *list-archive*-R*)
  34.         COMPREPLY=( $(compgen -W "-p" -- $cur) )
  35.         ;;
  36.     *list-archive*)
  37.         COMPREPLY=( $(compgen -W "-R" -- $cur) )
  38.         ;;
  39.     *set-menu*-R*)
  40.         COMPREPLY=( $(compgen -W "default= timeout=" -- $cur) )
  41.         compopt -o nospace
  42.         ;;
  43.     *set-menu*)
  44.         COMPREPLY=( $(compgen -W "-R default= timeout=" -- $cur) )
  45.         if [[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} != -R ]]; then
  46.             compopt -o nospace
  47.         fi
  48.         ;;
  49.     esac
  50.  
  51. }
  52.  
  53. complete -F _bootadm bootadm
Advertisement
Add Comment
Please, Sign In to add comment