_gas 847 B

12345678910111213141516171819202122232425262728293031323334
  1. #compdef gas
  2. local curcontext="$curcontext" state line cmds ret=1
  3. _arguments -C \
  4. '(- 1 *)'{-v,--version}'[display version information]' \
  5. '(-h|--help)'{-h,--help}'[show help information]' \
  6. '1: :->cmds' \
  7. '*: :->args' && ret=0
  8. case $state in
  9. cmds)
  10. cmds=(
  11. "version:Prints Gas's version"
  12. "use:Uses author"
  13. "show:Shows your current user"
  14. "list:Lists your authors"
  15. "import:Imports current user to gasconfig"
  16. "help:Describe available tasks or one specific task"
  17. "delete:Deletes author"
  18. "add:Adds author to gasconfig"
  19. )
  20. _describe -t commands 'gas command' cmds && ret=0
  21. ;;
  22. args)
  23. case $line[1] in
  24. (use|delete)
  25. _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
  26. ;;
  27. esac
  28. ;;
  29. esac
  30. return ret