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.

123456789101112131415161718192021222324252627282930
  1. #compdef ${PROG:=gitea}
  2. # Heavily inspired by https://github.com/urfave/cli
  3. _cli_zsh_autocomplete() {
  4. local -a opts
  5. local cur
  6. cur=${words[-1]}
  7. if [[ "$cur" == "-"* ]]; then
  8. opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
  9. else
  10. opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
  11. fi
  12. if [[ "${opts[1]}" != "" ]]; then
  13. _describe 'values' opts
  14. else
  15. _files
  16. fi
  17. return
  18. }
  19. if [ -z $PROG ] ; then
  20. compdef _cli_zsh_autocomplete gitea
  21. else
  22. compdef _cli_zsh_autocomplete $(basename $PROG)
  23. fi