Skip to content

Instantly share code, notes, and snippets.

@goodell
Created October 31, 2012 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goodell/3985045 to your computer and use it in GitHub Desktop.
Save goodell/3985045 to your computer and use it in GitHub Desktop.
beginning of a possible fix for mislav/hub#231
#compdef git-alias
#description show shell instructions for wrapping git
_arguments \
'-s[output shell script suitable for eval]' \
'1::shell:(zsh bash csh)'
#compdef git-browse
#description browse the project on GitHub
_arguments \
'-u[user or user/repository]:user or user/repository:' \
'::subpage:(wiki commits issues)'
#compdef git-compare
#description open GitHub compare view page
# FIXME ideally this wouldn't be needed (the zstyle functionality may be
# deprecated in the future), but since "hub compare" isn't actually a
# "git-compare" executable that ends up in the $commands array, _git_commands
# doesn't want to offer it when completing 'git compa<TAB>'.
#
# DOUBLE FIXME this doesn't work because the _git-compare script is never
# autoloaded until a completion is requested on "git compare <TAB>"...
zstyle ':completion:*:*:hub:*' user-commands compare:'open GitHub compare view page'
_arguments \
'-u[user]:user:' \
':[start...]end range:'
#compdef git-create
#description create new repo on GitHub for the current project
_arguments \
'::name (REPOSITORY or ORGANIZATION/REPOSITORY):' \
'-p[make repository private]' \
'-d[description]:description' \
'-h[home page]:repository home page URL:_urls'
#compdef git-fork
#description fork origin repo on GitHub
_arguments \
'--no-remote[do not add a remote for the new fork]'
#compdef git-pull-request
#description open a pull request on GitHub
# TODO could actually reach out and look some of this information up on GH
_arguments \
'-f[force (skip check for local commits)]' \
'-b[base]:base ("branch", "owner\:branch", "owner/repo\:branch"):' \
'-h[head]:head ("branch", "owner\:branch", "owner/repo\:branch"):' \
- set1 \
'::title:' \
- set2 \
'::issue-url:_urls' \
- set3 \
'-i[issue]:issue number:'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment