未验证 提交 7496b3da 编写于 作者: M Mislav Marohnić 提交者: GitHub

Merge pull request #2258 from lwolfsonkin/fish-completions-hub-pr

Added `hub pr` fish completions and wrapped `git` completions
complete -c hub --wraps git
function __fish_hub_needs_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 ]
......@@ -9,12 +11,17 @@ end
function __fish_hub_using_command
set cmd (commandline -opc)
if [ (count $cmd) -gt 1 ]
if [ $argv[1] = $cmd[2] ]
return 0
set subcmd_count (count $argv)
if [ (count $cmd) -gt "$subcmd_count" ]
for i in (seq 1 "$subcmd_count")
if [ "$argv[$i]" != $cmd[(math "$i" + 1)] ]
return 1
end
end
return 0
else
return 1
end
return 1
end
complete -f -c hub -n '__fish_hub_needs_command' -a alias -d "show shell instructions for wrapping git"
......@@ -24,7 +31,7 @@ complete -f -c hub -n '__fish_hub_needs_command' -a create -d "create new repo o
complete -f -c hub -n '__fish_hub_needs_command' -a delete -d "delete a GitHub repo"
complete -f -c hub -n '__fish_hub_needs_command' -a fork -d "fork origin repo on GitHub"
complete -f -c hub -n '__fish_hub_needs_command' -a pull-request -d "open a pull request on GitHub"
complete -f -c hub -n '__fish_hub_needs_command' -a pr -d "list or checkout a GitHub release"
complete -f -c hub -n '__fish_hub_needs_command' -a pr -d "list or checkout GitHub pull requests"
complete -f -c hub -n '__fish_hub_needs_command' -a issue -d "list or create a GitHub issue"
complete -f -c hub -n '__fish_hub_needs_command' -a release -d "list or create a GitHub release"
complete -f -c hub -n '__fish_hub_needs_command' -a ci-status -d "display GitHub Status information for a commit"
......@@ -44,6 +51,19 @@ complete -f -c hub -n ' __fish_hub_using_command pull-request' -s h -d 'The head
complete -f -c hub -n ' __fish_hub_using_command pull-request' -s a -d 'A comma-separated list of GitHub handles to assign to this pull request'
complete -f -c hub -n ' __fish_hub_using_command pull-request' -s M -d "The milestone name to add to this pull request. Passing the milestone number is deprecated."
complete -f -c hub -n ' __fish_hub_using_command pull-request' -s l -d "Add a comma-separated list of labels to this pull request"
# pr
complete -f -c hub -n ' __fish_hub_using_command pr' -l color -xa 'always never auto' -d 'enable colored output even if stdout is not a terminal. WHEN can be one of "always" (default for --color), "never", or "auto" (default).'
## pr list
complete -f -c hub -n ' __fish_hub_using_command pr' -a list -d "list pull requests in the current repository"
complete -f -c hub -n ' __fish_hub_using_command pr list' -s s -l state -xa 'open closed merged all' -d 'filter pull requests by STATE. default: open'
complete -f -c hub -n ' __fish_hub_using_command pr list' -s h -l head -d 'show pull requests started from the specified head BRANCH in "[OWNER:]BRANCH" format'
complete -f -c hub -n ' __fish_hub_using_command pr list' -s b -l base -d 'show pull requests based off the specified BRANCH'
complete -f -c hub -n ' __fish_hub_using_command pr list' -s o -l sort -xa 'created updated popularity long-running' -d 'default: created'
complete -f -c hub -n ' __fish_hub_using_command pr list' -s '^' -l sort-ascending -d 'sort by ascending dates instead of descending'
complete -f -c hub -n ' __fish_hub_using_command pr list' -s f -l format -d 'pretty print the list of pull requests using format FORMAT (default: "%pC%>(8)%i%Creset %t% l%n")'
complete -f -c hub -n ' __fish_hub_using_command pr list' -s L -l limit -d 'display only the first LIMIT issues'
## pr checkout
complete -f -c hub -n ' __fish_hub_using_command pr' -a checkout -d "check out the head of a pull request in a new branch"
# fork
complete -f -c hub -n ' __fish_hub_using_command fork' -l no-remote -d "Skip adding a git remote for the fork"
# browse
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册