/bash_completion.d/lilo

http://github.com/brinkman83/bashrc · #! · 61 lines · 55 code · 6 blank · 0 comment · 0 complexity · ae0e3deba30fabab91ef07a87bd0ef4a MD5 · raw file

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