/bash_completion_lib/complete/lilo

http://github.com/brinkman83/bashrc · #! · 57 lines · 48 code · 9 blank · 0 comment · 0 complexity · 3565d92bc256e37a0e95326d18e02cc8 MD5 · raw file

  1. # lilo(8) completion
  2. #
  3. comp_include _filedir _get_cword
  4. _lilo_labels()
  5. {
  6. COMPREPLY=( $( awk -F'=' '/label/ {print $2}' \
  7. /etc/lilo.conf | sed -e 's/"//g' | grep "^$cur" ) )
  8. }
  9. _lilo()
  10. {
  11. local cur prev
  12. COMPREPLY=()
  13. cur=`_get_cword`
  14. prev=${COMP_WORDS[COMP_CWORD-1]}
  15. case $prev in
  16. -@(C|i|m|s|S))
  17. _filedir
  18. return 0
  19. ;;
  20. -r)
  21. _filedir -d
  22. return 0
  23. ;;
  24. -@(I|D|R))
  25. # label completion
  26. _lilo_labels
  27. return 0
  28. ;;
  29. -@(A|b|M|u|U))
  30. # device completion
  31. cur=${cur:=/dev/}
  32. _filedir
  33. return 0
  34. ;;
  35. -T)
  36. # topic completion
  37. COMPREPLY=( $( compgen -W 'help ChRul EBDA geom geom= \
  38. table= video' -- $cur ) )
  39. return 0
  40. ;;
  41. esac
  42. if [[ "$cur" == -* ]]; then
  43. # relevant options completion
  44. COMPREPLY=( $( compgen -W '-A -b -c -C -d -f -g -i -I -l -L -m \
  45. -M -p -P -q -r -R -s -S -t -T -u -U -v -V -w -x -z' -- \
  46. $cur ) )
  47. fi
  48. } # _lilo()