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.5KB

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