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.

138 lines
3.8KB

  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 --help --version --base-url "
  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. *)
  61. COMPREPLY=()
  62. ;;
  63. esac
  64. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  65. return 0
  66. ;;
  67. gutenberg__help)
  68. opts=" -h -V --help --version "
  69. if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
  70. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  71. return 0
  72. fi
  73. case "${prev}" in
  74. *)
  75. COMPREPLY=()
  76. ;;
  77. esac
  78. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  79. return 0
  80. ;;
  81. gutenberg__init)
  82. opts=" -h -V --help --version <name> "
  83. if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
  84. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  85. return 0
  86. fi
  87. case "${prev}" in
  88. *)
  89. COMPREPLY=()
  90. ;;
  91. esac
  92. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  93. return 0
  94. ;;
  95. gutenberg__serve)
  96. opts=" -h -V -i -p --help --version --interface --port "
  97. if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
  98. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  99. return 0
  100. fi
  101. case "${prev}" in
  102. --interface)
  103. COMPREPLY=("<interface>")
  104. return 0
  105. ;;
  106. -i)
  107. COMPREPLY=("<interface>")
  108. return 0
  109. ;;
  110. --port)
  111. COMPREPLY=("<port>")
  112. return 0
  113. ;;
  114. -p)
  115. COMPREPLY=("<port>")
  116. return 0
  117. ;;
  118. *)
  119. COMPREPLY=()
  120. ;;
  121. esac
  122. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  123. return 0
  124. ;;
  125. esac
  126. }
  127. complete -F _gutenberg -o bashdefault -o default gutenberg