my xfce4 dotfiles
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.

39 lines
1.1 KiB

3 years ago
  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. "ssh:Creates a new ssh key for an existing gas author"
  14. "show:Shows your current user"
  15. "list:Lists your authors"
  16. "import:Imports current user to gasconfig"
  17. "help:Describe available tasks or one specific task"
  18. "delete:Deletes author"
  19. "add:Adds author to gasconfig"
  20. )
  21. _describe -t commands 'gas command' cmds && ret=0
  22. ;;
  23. args)
  24. case $line[1] in
  25. (use|delete)
  26. VERSION=$(gas -v)
  27. if [[ $VERSION == <1->.*.* ]] || [[ $VERSION == 0.<2->.* ]] || [[ $VERSION == 0.1.<6-> ]] then
  28. _values -S , 'authors' $(cat ~/.gas/gas.authors | sed -n -e 's/^.*\[\(.*\)\]/\1/p') && ret=0
  29. else
  30. _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
  31. fi
  32. esac
  33. ;;
  34. esac
  35. return ret