#compdef github _github() { if (( CURRENT > 2 )); then # shift words so _arguments doesn't have to be concerned with second command (( CURRENT-- )) shift words # use _call_function here in case it doesn't exist _call_function 1 _github_${words[1]} else _values "github command" \ "fetch[Fetch from a remote to a local branch.]" \ "ignore[Ignore a SHA (from 'github network commits')]" \ "fetch_all[Fetch all refs from a user]" \ "info[Info about this project.]" \ "browse[Open this repo in a web browser.]" \ "home[Open this repo's master branch in a web browser.]" \ "clone[Clone a repo.]" \ "pull-request[Generate the text for a pull request.]" \ "network[Project network tools.]" \ "pull[Pull from a remote.]" \ "track[Track another user's repository.]" fi } _github_pull() { _arguments \ "--merge[Automatically merge remote's changes into your master.]" } _github_clone() { _arguments \ "--ssh[Clone using the git@github.com style url.]" } _github_track() { _arguments \ "--private[Use git@github.com: instead of git://github.com/.]" \ "--ssh[Equivalent to --private.]" } _github_network() { if (( CURRENT > 2 )); then # shift words so _arguments doesn't have to be concerned with second command (( CURRENT-- )) shift words # use _call_function here in case it doesn't exist _call_function 1 _github_network_${words[1]} else _values "github network command" \ "web[Open network in a web browser.]" \ "list[List networked repositories.]" \ "fetch[Fetched commits for a given networked repository.]" \ "commits[List networked commits not pulled into this repo.]" fi } _github_network_commits() { _arguments \ "--project[Filter commits on a certain project.]" \ "--author[Filter commits on a email address of author.]" \ "--common[Show common branch point.]" \ "--nocache[Do not use the cached network data.]" \ "--sort[How to sort : date(*), branch, author.]" \ "--thisbranch[Look at branches that match the current one]" \ "--applies[Filter commits to patches that apply cleanly.]" \ "--limit[Only look through the first X heads - useful for really large projects]" \ "--before[Only show commits before a certain date.]" \ "--after[Only show commits after a certain date.]" \ "--shas[Only show shas.]" \ "--cache[Use the network data even if it's expired.]" \ "--noapply[Filter commits to patches that do not apply cleanly.]" }