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.

_zola 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. #compdef zola
  2. autoload -U is-at-least
  3. _zola() {
  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. ":: :_zola_commands" \
  21. "*::: :->zola" \
  22. && ret=0
  23. case $state in
  24. (zola)
  25. words=($line[1] "${words[@]}")
  26. (( CURRENT += 1 ))
  27. curcontext="${curcontext%:*:*}:zola-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[_zola_commands] )) ||
  79. _zola_commands() {
  80. local commands; commands=(
  81. "init:Create a new Zola 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 'zola commands' commands "$@"
  87. }
  88. (( $+functions[_zola__build_commands] )) ||
  89. _zola__build_commands() {
  90. local commands; commands=(
  91. )
  92. _describe -t commands 'zola build commands' commands "$@"
  93. }
  94. (( $+functions[_zola__help_commands] )) ||
  95. _zola__help_commands() {
  96. local commands; commands=(
  97. )
  98. _describe -t commands 'zola help commands' commands "$@"
  99. }
  100. (( $+functions[_zola__init_commands] )) ||
  101. _zola__init_commands() {
  102. local commands; commands=(
  103. )
  104. _describe -t commands 'zola init commands' commands "$@"
  105. }
  106. (( $+functions[_zola__serve_commands] )) ||
  107. _zola__serve_commands() {
  108. local commands; commands=(
  109. )
  110. _describe -t commands 'zola serve commands' commands "$@"
  111. }
  112. _zola "$@"