# shellcheck shell=dash disable=SC3043,SC2154
# https://docs.github.com/en/rest/releases/assets#delete-a-release-asset
___x_cmd_gh_repo_release_attachment_rm() {
    param:scope     ___x_cmd_github
    param:dsl    '
options:
    #1          "Release Attachment ID"                     <>:Number
    --repo|-r   "<owner_path>/<repo_path>"                  <>:RepoName
    --yes|-y    "Ignore remove prompt interception"
'
    param:run
    ___x_cmd_gh_param_init_owner_repo
    [ "$yes" = "true" ] || ___x_cmd_ui_yesno "Are you sure you want to remove release attachment $(___x_cmd_ui bold red "$1") on $owner_repo repo ?" || return
    ___x_cmd_gh_curl del "/repos/${owner_repo}/releases/assets/${1##*/}" | (
            [ -z "$___X_CMD_GH_IN_TEST" ] || { ___x_cmd_cmds_cat; return; }
            x jo env . gh_resp_msg=.message gh_resp_err=.errors
            if ___x_cmd_gh_http_error; then
                ___x_cmd_ui_tf  true "Remove ${owner_repo} ${1##*/} release attachment successfully"
            else
                ___x_cmd_ui_tf false "Remove ${owner_repo} ${1##*/} release attachment failure" >&2
                ___x_cmd_gh____handle_resp
                return 1
            fi
        )
}
