hive-forge: restore issue-edit verb lost in rebase

This commit is contained in:
damocles 2026-05-21 23:47:18 +02:00
parent 0615b0521f
commit 02ace544bc

View file

@ -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 "$@" ;;