OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
2.9 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../bashcompletion/rock-tools
  5. # Copyright (C) 1998 - 2004 Clifford Wolf
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- SDE-COPYRIGHT-NOTE-END ---
  14. _interfaces() {
  15. COMPREPLY=( $( compgen -W "$( command \
  16. sed -ne 's|^interface \([^ ]\+\).*$|\1|p' \
  17. /etc/network/config )" -- $cur ) )
  18. }
  19. _mine_installed_packages() {
  20. COMPREPLY=( $( compgen -W "`(cd /var/adm/packages; echo *)`" -- $cur ) )
  21. }
  22. _mine() {
  23. local cur prev
  24. COMPREPLY=()
  25. cur=${COMP_WORDS[COMP_CWORD]}
  26. prev=${COMP_WORDS[COMP_CWORD-1]}
  27. if [ $COMP_CWORD -eq 1 ]; then
  28. case "$cur" in
  29. *)
  30. COMPREPLY=( $( compgen -W '-i -r -q -p -l -m -c -d -k -C -T' \
  31. -- $cur ) )
  32. ;;
  33. esac
  34. return 0
  35. fi
  36. case "$prev" in
  37. -R)
  38. _filedir -d
  39. return 0
  40. ;;
  41. -k)
  42. COMPREPLY=( $( compgen -W 'pkg_name pkg_version pkg_tarbz2 \
  43. pkg_config packages flists md5sums cksums \
  44. dependencies descs creator COPY I TITLE T \
  45. TEXT U URL A AUTHOR M MAINTAINER C CATEGORY \
  46. F FLAG R ARCH ARCHITECTURE E DEP DEPENDENCY \
  47. L LICENSE S STATUS V VER VERSION P PRI \
  48. PRIORITY CV-URL CV-PAT CV-DEL O CONF D DOWN \
  49. DOWNLOAD SRC SOURCEPACKAGE' -- $cur ) )
  50. return 0
  51. esac
  52. case "${COMP_WORDS[1]}" in
  53. -i)
  54. if [[ "$cur" == -* ]]; then
  55. COMPREPLY=( $( compgen -W '-t -v -f -R' -- $cur ) )
  56. else
  57. _filedir 'gem'
  58. fi
  59. ;;
  60. -r)
  61. if [[ "$cur" == -* ]]; then
  62. COMPREPLY=( $( compgen -W '-t -v -f -R' -- $cur ) )
  63. else
  64. _mine_installed_packages
  65. fi
  66. ;;
  67. -[qplmcd])
  68. if [[ "$cur" == -* ]]; then
  69. COMPREPLY=( $( compgen -W '-h -H' -- $cur ) )
  70. else
  71. _mine_installed_packages
  72. _filedir 'gem'
  73. fi
  74. ;;
  75. -k)
  76. if [[ "$cur" == -* ]]; then
  77. COMPREPLY=( $( compgen -W '-h -H' -- $cur ) )
  78. else
  79. _filedir 'gem'
  80. fi
  81. ;;
  82. -C)
  83. case "$COMP_CWORD" in
  84. 2)
  85. _filedir -d
  86. ;;
  87. 3)
  88. _filedir 'tar.bz2'
  89. ;;
  90. 4)
  91. _mine_installed_packages
  92. ;;
  93. esac
  94. ;;
  95. -T)
  96. case "$COMP_CWORD" in
  97. 2|3)
  98. _filedir -d
  99. ;;
  100. 4)
  101. _mine_installed_packages
  102. ;;
  103. esac
  104. esac
  105. return 0
  106. }
  107. complete -F _mine $filenames mine
  108. _rc()
  109. {
  110. COMPREPLY=()
  111. cur=${COMP_WORDS[COMP_CWORD]}
  112. prev=${COMP_WORDS[COMP_CWORD-1]}
  113. if [ $COMP_CWORD -eq 1 ]; then
  114. #first parameter on line
  115. if [ -r /etc/rc.d/init.d ]; then
  116. COMPREPLY=( $( compgen -W "`(cd /etc/rc.d/init.d; echo *)`" \
  117. -- $cur ) )
  118. fi
  119. return 0
  120. fi
  121. if [ $COMP_CWORD -eq 2 ]; then
  122. #second parameter on line
  123. COMPREPLY=( $( compgen -W "$( command rc $prev help | \
  124. cut -d{ -f2 | tr -d '{}|' )" \
  125. -- $cur ) )
  126. return 0
  127. fi
  128. }
  129. complete -F _rc $filenames rc