Watch
0
0
Fork
You've already forked hyperhive
0

hive-forge: dedup the --json refusal into refuse_json(), test it, cover attachment-get/artifact-get too

This commit is contained in:
damocles 2026-10-04 08:10:43 +02:00
commit e18497bb70
8 changed files with 58 additions and 27 deletions

View file

@ -26,6 +26,7 @@ use clap::Args as ClapArgs;
use forgejo_api::structs::ListActionRunsQuery;
use crate::client::Client;
use crate::verbs::refuse_json;
#[derive(ClapArgs)]
pub struct Args {
@ -82,6 +83,11 @@ fn resolve_run_id(client: &Client, repo: &str, run_number: u64) -> Result<i64> {
/// download fails (network, or a non-2xx status such as `404` for an
/// unknown artifact name), or if the output path can't be written.
pub fn run(client: &Client, args: Args) -> Result<()> {
refuse_json(
client.json_mode(),
"artifact-get",
"it downloads the raw artifact zip, there is no JSON form",
)?;
let repo = client.repo()?;
let run_id = resolve_run_id(client, repo, args.run)?;
let url = client.web_url(&format!(