hive-forge: dedup the --json refusal into refuse_json(), test it, cover attachment-get/artifact-get too
This commit is contained in:
parent
e0ad3a567b
commit
e18497bb70
8 changed files with 58 additions and 27 deletions
|
|
@ -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!(
|
||||
|
|
|
|||
Loading…
Reference in a new issue