hive-forge: restore issue-edit verb lost in rebase
This commit is contained in:
parent
0615b0521f
commit
02ace544bc
1 changed files with 28 additions and 0 deletions
|
|
@ -278,6 +278,33 @@ pkgs.writeShellApplication {
|
|||
| jq -r '.html_url'
|
||||
}
|
||||
|
||||
cmd_issue_edit() {
|
||||
# issue-edit <number> [--title <title>] [--body <body>] [--state open|closed] [repo]
|
||||
# Edit an issue's title, body, or state. Only provided fields are changed.
|
||||
if [ $# -lt 1 ]; then echo "usage: hive-forge issue-edit <number> [--title <title>] [--body <body>] [--state open|closed] [repo]" >&2; exit 1; fi
|
||||
local _n="$1"; shift
|
||||
local _title="" _body="" _state="" _repo="$HIVE_FORGE_REPO"
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--title) _title="$2"; shift 2 ;;
|
||||
--body) _body="$2"; shift 2 ;;
|
||||
--state) _state="$2"; shift 2 ;;
|
||||
*) _repo="$1"; shift ;;
|
||||
esac
|
||||
done
|
||||
local _payload
|
||||
_payload=$(jq -n \
|
||||
--arg title "$_title" \
|
||||
--arg body "$_body" \
|
||||
--arg state "$_state" \
|
||||
'{} |
|
||||
if $title != "" then . + {title:$title} else . end |
|
||||
if $body != "" then . + {body:$body} else . end |
|
||||
if $state != "" then . + {state:$state} else . end')
|
||||
forge_patch "$FORGE_API/repos/$_repo/issues/$_n" "$_payload" \
|
||||
| jq '{number,title,state}'
|
||||
}
|
||||
|
||||
cmd_attach_issue() {
|
||||
# attach-issue <number> <file> [repo]
|
||||
# Upload a file as an attachment to an issue. Prints the download URL.
|
||||
|
|
@ -358,6 +385,7 @@ pkgs.writeShellApplication {
|
|||
view) cmd_view "$@" ;;
|
||||
issue) cmd_issue "$@" ;;
|
||||
issue-create) cmd_issue_create "$@" ;;
|
||||
issue-edit) cmd_issue_edit "$@" ;;
|
||||
pr) cmd_pr "$@" ;;
|
||||
pr-create) cmd_pr_create "$@" ;;
|
||||
comment) cmd_comment "$@" ;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue