_github 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #compdef github
  2. _github() {
  3. if (( CURRENT > 2 )); then
  4. # shift words so _arguments doesn't have to be concerned with second command
  5. (( CURRENT-- ))
  6. shift words
  7. # use _call_function here in case it doesn't exist
  8. _call_function 1 _github_${words[1]}
  9. else
  10. _values "github command" \
  11. "fetch[Fetch from a remote to a local branch.]" \
  12. "ignore[Ignore a SHA (from 'github network commits')]" \
  13. "fetch_all[Fetch all refs from a user]" \
  14. "info[Info about this project.]" \
  15. "browse[Open this repo in a web browser.]" \
  16. "home[Open this repo's master branch in a web browser.]" \
  17. "clone[Clone a repo.]" \
  18. "pull-request[Generate the text for a pull request.]" \
  19. "network[Project network tools.]" \
  20. "pull[Pull from a remote.]" \
  21. "track[Track another user's repository.]"
  22. fi
  23. }
  24. _github_pull() {
  25. _arguments \
  26. "--merge[Automatically merge remote's changes into your master.]"
  27. }
  28. _github_clone() {
  29. _arguments \
  30. "--ssh[Clone using the git@github.com style url.]"
  31. }
  32. _github_track() {
  33. _arguments \
  34. "--private[Use git@github.com: instead of git://github.com/.]" \
  35. "--ssh[Equivalent to --private.]"
  36. }
  37. _github_network() {
  38. if (( CURRENT > 2 )); then
  39. # shift words so _arguments doesn't have to be concerned with second command
  40. (( CURRENT-- ))
  41. shift words
  42. # use _call_function here in case it doesn't exist
  43. _call_function 1 _github_network_${words[1]}
  44. else
  45. _values "github network command" \
  46. "web[Open network in a web browser.]" \
  47. "list[List networked repositories.]" \
  48. "fetch[Fetched commits for a given networked repository.]" \
  49. "commits[List networked commits not pulled into this repo.]"
  50. fi
  51. }
  52. _github_network_commits() {
  53. _arguments \
  54. "--project[Filter commits on a certain project.]" \
  55. "--author[Filter commits on a email address of author.]" \
  56. "--common[Show common branch point.]" \
  57. "--nocache[Do not use the cached network data.]" \
  58. "--sort[How to sort : date(*), branch, author.]" \
  59. "--thisbranch[Look at branches that match the current one]" \
  60. "--applies[Filter commits to patches that apply cleanly.]" \
  61. "--limit[Only look through the first X heads - useful for really large projects]" \
  62. "--before[Only show commits before a certain date.]" \
  63. "--after[Only show commits after a certain date.]" \
  64. "--shas[Only show shas.]" \
  65. "--cache[Use the network data even if it's expired.]" \
  66. "--noapply[Filter commits to patches that do not apply cleanly.]"
  67. }