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.

105 lines
2.9KB

  1. #compdef gutenberg
  2. _gutenberg() {
  3. typeset -A opt_args
  4. local ret=1
  5. local context curcontext="$curcontext" state line
  6. _arguments -s -S -C \
  7. '-c[Path to a config file other than config.toml]' \
  8. '--config[Path to a config file other than config.toml]' \
  9. '-h[Prints help information]' \
  10. '--help[Prints help information]' \
  11. '-V[Prints version information]' \
  12. '--version[Prints version information]' \
  13. "1:: :_gutenberg_commands" \
  14. "*:: :->gutenberg" \
  15. && ret=0
  16. case $state in
  17. (gutenberg)
  18. curcontext="${curcontext%:*:*}:gutenberg-command-$words[1]:"
  19. case $line[1] in
  20. (init)
  21. _arguments -s -S -C \
  22. '-h[Prints help information]' \
  23. '--help[Prints help information]' \
  24. '-V[Prints version information]' \
  25. '--version[Prints version information]' \
  26. "1:: :_gutenberg__init_commands" \
  27. && ret=0
  28. ;;
  29. (build)
  30. _arguments -s -S -C \
  31. '-u+[Force the base URL to be that value (default to the one in config.toml)]' \
  32. '--base-url+[Force the base URL to be that value (default to the one in config.toml)]' \
  33. '-h[Prints help information]' \
  34. '--help[Prints help information]' \
  35. '-V[Prints version information]' \
  36. '--version[Prints version information]' \
  37. && ret=0
  38. ;;
  39. (serve)
  40. _arguments -s -S -C \
  41. '-i+[Interface to bind on]' \
  42. '--interface+[Interface to bind on]' \
  43. '-p+[Which port to use]' \
  44. '--port+[Which port to use]' \
  45. '-h[Prints help information]' \
  46. '--help[Prints help information]' \
  47. '-V[Prints version information]' \
  48. '--version[Prints version information]' \
  49. && ret=0
  50. ;;
  51. (help)
  52. _arguments -s -S -C \
  53. '-h[Prints help information]' \
  54. '--help[Prints help information]' \
  55. '-V[Prints version information]' \
  56. '--version[Prints version information]' \
  57. && ret=0
  58. ;;
  59. esac
  60. ;;
  61. esac
  62. }
  63. (( $+functions[_gutenberg_commands] )) ||
  64. _gutenberg_commands() {
  65. local commands; commands=(
  66. "init:Create a new Gutenberg project" \
  67. "build:Builds the site" \
  68. "serve:Serve the site. Rebuild and reload on change automatically" \
  69. "help:Prints this message or the help of the given subcommand(s)" \
  70. )
  71. _describe -t commands 'gutenberg commands' commands "$@"
  72. }
  73. (( $+functions[_gutenberg__build_commands] )) ||
  74. _gutenberg__build_commands() {
  75. local commands; commands=(
  76. )
  77. _describe -t commands 'gutenberg build commands' commands "$@"
  78. }
  79. (( $+functions[_gutenberg__help_commands] )) ||
  80. _gutenberg__help_commands() {
  81. local commands; commands=(
  82. )
  83. _describe -t commands 'gutenberg help commands' commands "$@"
  84. }
  85. (( $+functions[_gutenberg__init_commands] )) ||
  86. _gutenberg__init_commands() {
  87. local commands; commands=(
  88. "NAME:Name of the project. Will create a new directory with that name in the current directory" \
  89. )
  90. _describe -t commands 'gutenberg init commands' commands "$@"
  91. }
  92. (( $+functions[_gutenberg__serve_commands] )) ||
  93. _gutenberg__serve_commands() {
  94. local commands; commands=(
  95. )
  96. _describe -t commands 'gutenberg serve commands' commands "$@"
  97. }
  98. _gutenberg "$@"