mirror of
https://github.com/zsh-users/zsh-completions.git
synced 2026-09-17 16:00:19 +00:00
Zsh gh completion: Add completion for issues
This commit is contained in:
@@ -207,6 +207,9 @@ function _gh_help {
|
||||
function _gh_issue {
|
||||
local -a commands
|
||||
|
||||
zstyle -s ':completion:*:*:gh:argument-1:' sort oldsort # Save the sort setting
|
||||
zstyle ':completion:*:*:gh:argument-1:' sort false
|
||||
|
||||
_arguments -C \
|
||||
'(-R --repo)'{-R,--repo}'[Select another repository using the `OWNER/REPO` format]:' \
|
||||
'--help[Show help for command]' \
|
||||
@@ -247,10 +250,17 @@ function _gh_issue {
|
||||
_gh_issue_view
|
||||
;;
|
||||
esac
|
||||
zstyle ':completion:*:*:gh:argument-1:' sort $oldsort # Restore the sort setting
|
||||
}
|
||||
|
||||
function __issue_numbers {
|
||||
local options=$(gh issue list "$@" | awk -F '\t' '{print $1 "\\:" "\"" $3 " (" tolower($2) ")" "\""}' | tr '\n' ' ')
|
||||
echo $options
|
||||
}
|
||||
|
||||
function _gh_issue_close {
|
||||
_arguments \
|
||||
_arguments -C \
|
||||
"1:Issue:(($(__issue_numbers --state open)))" \
|
||||
'--help[Show help for command]' \
|
||||
'(-R --repo)'{-R,--repo}'[Select another repository using the `OWNER/REPO` format]:'
|
||||
}
|
||||
@@ -283,7 +293,8 @@ function _gh_issue_list {
|
||||
}
|
||||
|
||||
function _gh_issue_reopen {
|
||||
_arguments \
|
||||
_arguments -C \
|
||||
"1:Issue:(($(__issue_numbers --state closed)))" \
|
||||
'--help[Show help for command]' \
|
||||
'(-R --repo)'{-R,--repo}'[Select another repository using the `OWNER/REPO` format]:'
|
||||
}
|
||||
@@ -295,7 +306,8 @@ function _gh_issue_status {
|
||||
}
|
||||
|
||||
function _gh_issue_view {
|
||||
_arguments \
|
||||
_arguments -C \
|
||||
"1:Issue:(($(__issue_numbers --state all)))" \
|
||||
'(-w --web)'{-w,--web}'[Open an issue in the browser]' \
|
||||
'--help[Show help for command]' \
|
||||
'(-R --repo)'{-R,--repo}'[Select another repository using the `OWNER/REPO` format]:'
|
||||
|
||||
Reference in New Issue
Block a user