My personal 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.

_gas 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #compdef gas
  2. # ------------------------------------------------------------------------------
  3. # Copyright (c) 2016 Github zsh-users - http://github.com/zsh-users
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining
  6. # a copy of this software and associated documentation files (the
  7. # "Software"), to deal in the Software without restriction, including
  8. # without limitation the rights to use, copy, modify, merge, publish,
  9. # distribute, sublicense, and/or sell copies of the Software, and to
  10. # permit persons to whom the Software is furnished to do so, subject to
  11. # the following conditions:
  12. #
  13. # The above copyright notice and this permission notice shall be included
  14. # in all copies or substantial portions of the Software.
  15. #
  16. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17. # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. # OTHER DEALINGS IN THE SOFTWARE.
  23. # ------------------------------------------------------------------------------
  24. # Description
  25. # -----------
  26. #
  27. # Completion script for gas (https://github.com/walle/gas).
  28. #
  29. # ------------------------------------------------------------------------------
  30. # Authors
  31. # -------
  32. #
  33. # * Fredrik Wallgren <fredrik.wallgren@gmail.com>
  34. #
  35. # ------------------------------------------------------------------------------
  36. local curcontext="$curcontext" state line cmds ret=1
  37. _arguments -C \
  38. '(- 1 *)'{-v,--version}'[display version information]' \
  39. '(-h|--help)'{-h,--help}'[show help information]' \
  40. '1: :->cmds' \
  41. '*: :->args' && ret=0
  42. case "$state" in
  43. (cmds)
  44. cmds=(
  45. "version:Prints Gas's version"
  46. "use:Uses author"
  47. "show:Shows your current user"
  48. "list:Lists your authors"
  49. "import:Imports current user to gasconfig"
  50. "help:Describe available tasks or one specific task"
  51. "delete:Deletes author"
  52. "add:Adds author to gasconfig"
  53. )
  54. _describe -t commands 'gas command' cmds && ret=0
  55. ;;
  56. (args)
  57. case "$line[1]" in
  58. (use|delete)
  59. _values -S , 'authors' $(cat ~/.gas | sed -n -e 's/^\[\(.*\)\]/\1/p') && ret=0
  60. ;;
  61. esac
  62. ;;
  63. esac
  64. return ret