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.

gutenberg.bash 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. _gutenberg() {
  2. local i cur prev opts cmds
  3. COMPREPLY=()
  4. cur="${COMP_WORDS[COMP_CWORD]}"
  5. prev="${COMP_WORDS[COMP_CWORD-1]}"
  6. cmd=""
  7. opts=""
  8. for i in ${COMP_WORDS[@]}
  9. do
  10. case "${i}" in
  11. gutenberg)
  12. cmd="gutenberg"
  13. ;;
  14. build)
  15. cmd+="__build"
  16. ;;
  17. help)
  18. cmd+="__help"
  19. ;;
  20. init)
  21. cmd+="__init"
  22. ;;
  23. serve)
  24. cmd+="__serve"
  25. ;;
  26. *)
  27. ;;
  28. esac
  29. done
  30. case "${cmd}" in
  31. gutenberg)
  32. opts=" -c -h -V --config --help --version init build serve help"
  33. if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
  34. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  35. return 0
  36. fi
  37. case "${prev}" in
  38. *)
  39. COMPREPLY=()
  40. ;;
  41. esac
  42. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  43. return 0
  44. ;;
  45. gutenberg__build)
  46. opts=" -h -V -u -o --help --version --base-url --output-dir "
  47. if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
  48. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  49. return 0
  50. fi
  51. case "${prev}" in
  52. --base-url)
  53. COMPREPLY=("<base_url>")
  54. return 0
  55. ;;
  56. -u)
  57. COMPREPLY=("<base_url>")
  58. return 0
  59. ;;
  60. --output-dir)
  61. COMPREPLY=("<output_dir>")
  62. return 0
  63. ;;
  64. -o)
  65. COMPREPLY=("<output_dir>")
  66. return 0
  67. ;;
  68. *)
  69. COMPREPLY=()
  70. ;;
  71. esac
  72. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  73. return 0
  74. ;;
  75. gutenberg__help)
  76. opts=" -h -V --help --version "
  77. if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
  78. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  79. return 0
  80. fi
  81. case "${prev}" in
  82. *)
  83. COMPREPLY=()
  84. ;;
  85. esac
  86. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  87. return 0
  88. ;;
  89. gutenberg__init)
  90. opts=" -h -V --help --version <name> "
  91. if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
  92. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  93. return 0
  94. fi
  95. case "${prev}" in
  96. *)
  97. COMPREPLY=()
  98. ;;
  99. esac
  100. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  101. return 0
  102. ;;
  103. gutenberg__serve)
  104. opts=" -h -V -i -p -o -u --help --version --interface --port --output-dir --base-url "
  105. if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
  106. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  107. return 0
  108. fi
  109. case "${prev}" in
  110. --interface)
  111. COMPREPLY=("<interface>")
  112. return 0
  113. ;;
  114. -i)
  115. COMPREPLY=("<interface>")
  116. return 0
  117. ;;
  118. --port)
  119. COMPREPLY=("<port>")
  120. return 0
  121. ;;
  122. -p)
  123. COMPREPLY=("<port>")
  124. return 0
  125. ;;
  126. --output-dir)
  127. COMPREPLY=("<output_dir>")
  128. return 0
  129. ;;
  130. -o)
  131. COMPREPLY=("<output_dir>")
  132. return 0
  133. ;;
  134. --base-url)
  135. COMPREPLY=("<base_url>")
  136. return 0
  137. ;;
  138. -u)
  139. COMPREPLY=("<base_url>")
  140. return 0
  141. ;;
  142. *)
  143. COMPREPLY=()
  144. ;;
  145. esac
  146. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  147. return 0
  148. ;;
  149. esac
  150. }
  151. complete -F _gutenberg -o bashdefault -o default gutenberg