zsh-completions/_github

65 lines
2.0 KiB
Plaintext

#compdef github gh
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for Github gem (https://github.com/defunkt/github-gem).
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * Julien Nicoulaud (https://github.com/nicoulaj)
#
# ------------------------------------------------------------------------------
# -*- mode: zsh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*-
# vim: ft=zsh sw=2 ts=2 et
# ------------------------------------------------------------------------------
typeset -A opt_args
local context state line curcontext="$curcontext"
_github() {
local ret=1
_arguments -C \
'1:cmd:->cmds' \
'*::arg:->args' \
&& ret=0
case "$state" in
(cmds)
local commands; commands=(
'admin:open this repo'\''s Admin panel a web browser'
'browse:open this repo in a web browser'
'clone:clone a repo'
'config:automatically set configuration info, or pass args to specify'
'create:create a new, empty GitHub repository'
'create-from-local:create a new GitHub repository from the current local repository'
'fetch:fetch from a remote to a local branch'
'fetch_all:fetch all refs from a user'
'fork:forks a GitHub repository'
'home:open this repo'\''s master branch in a web browser'
'ignore:ignore a SHA'
'info:info about this project'
'issues:project issues tools'
'network:project network tools'
'open:open the given user/project in a web browser'
'pull:pull from a remote'
'pull-request:generate the text for a pull request'
'search:search GitHub for the given repository name'
'track:track another user'\''s repository'
)
_describe -t commands 'command' commands && ret=0
;;
(args)
curcontext="${curcontext%:*:*}:github-cmd-$words[1]:"
;;
esac
return ret
}
_github "$@"