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.

101 lines
2.8KB

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