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.

122 lines
3.3KB

  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=" -h -V -c --help --version --config 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. --config)
  39. COMPREPLY=("<config>")
  40. return 0
  41. ;;
  42. -c)
  43. COMPREPLY=("<config>")
  44. return 0
  45. ;;
  46. *)
  47. COMPREPLY=()
  48. ;;
  49. esac
  50. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  51. return 0
  52. ;;
  53. gutenberg__build)
  54. opts=" -h -V --help --version "
  55. if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
  56. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  57. return 0
  58. fi
  59. case "${prev}" in
  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 --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. *)
  103. COMPREPLY=()
  104. ;;
  105. esac
  106. COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
  107. return 0
  108. ;;
  109. esac
  110. }
  111. complete -F _gutenberg -o bashdefault -o default gutenberg