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.

109 lines
3.1KB

  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. '-o+[Outputs the generated site in the given path]' \
  34. '--output-dir+[Outputs the generated site in the given path]' \
  35. '-h[Prints help information]' \
  36. '--help[Prints help information]' \
  37. '-V[Prints version information]' \
  38. '--version[Prints version information]' \
  39. && ret=0
  40. ;;
  41. (serve)
  42. _arguments -s -S -C \
  43. '-i+[Interface to bind on]' \
  44. '--interface+[Interface to bind on]' \
  45. '-p+[Which port to use]' \
  46. '--port+[Which port to use]' \
  47. '-o+[Outputs the generated site in the given path]' \
  48. '--output-dir+[Outputs the generated site in the given path]' \
  49. '-h[Prints help information]' \
  50. '--help[Prints help information]' \
  51. '-V[Prints version information]' \
  52. '--version[Prints version information]' \
  53. && ret=0
  54. ;;
  55. (help)
  56. _arguments -s -S -C \
  57. '-h[Prints help information]' \
  58. '--help[Prints help information]' \
  59. '-V[Prints version information]' \
  60. '--version[Prints version information]' \
  61. && ret=0
  62. ;;
  63. esac
  64. ;;
  65. esac
  66. }
  67. (( $+functions[_gutenberg_commands] )) ||
  68. _gutenberg_commands() {
  69. local commands; commands=(
  70. "init:Create a new Gutenberg project" \
  71. "build:Builds the site" \
  72. "serve:Serve the site. Rebuild and reload on change automatically" \
  73. "help:Prints this message or the help of the given subcommand(s)" \
  74. )
  75. _describe -t commands 'gutenberg commands' commands "$@"
  76. }
  77. (( $+functions[_gutenberg__build_commands] )) ||
  78. _gutenberg__build_commands() {
  79. local commands; commands=(
  80. )
  81. _describe -t commands 'gutenberg build commands' commands "$@"
  82. }
  83. (( $+functions[_gutenberg__help_commands] )) ||
  84. _gutenberg__help_commands() {
  85. local commands; commands=(
  86. )
  87. _describe -t commands 'gutenberg help commands' commands "$@"
  88. }
  89. (( $+functions[_gutenberg__init_commands] )) ||
  90. _gutenberg__init_commands() {
  91. local commands; commands=(
  92. "NAME:Name of the project. Will create a new directory with that name in the current directory" \
  93. )
  94. _describe -t commands 'gutenberg init commands' commands "$@"
  95. }
  96. (( $+functions[_gutenberg__serve_commands] )) ||
  97. _gutenberg__serve_commands() {
  98. local commands; commands=(
  99. )
  100. _describe -t commands 'gutenberg serve commands' commands "$@"
  101. }
  102. _gutenberg "$@"