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
1 changed files with 58 additions and 27 deletions
|
|
@ -13,11 +13,12 @@
|
|||
//! lockfile without any information the reader can act on.
|
||||
//! Pass `--full` to dump the unfiltered diff.
|
||||
|
||||
use anyhow::{Result, bail};
|
||||
use anyhow::Result;
|
||||
use clap::Args as ClapArgs;
|
||||
use forgejo_api::structs::RepoDownloadPullDiffOrPatchQuery;
|
||||
|
||||
use crate::client::{Client, index};
|
||||
use crate::verbs::refuse_json;
|
||||
|
||||
#[derive(ClapArgs)]
|
||||
pub struct Args {
|
||||
|
|
@ -31,9 +32,7 @@ pub struct Args {
|
|||
}
|
||||
|
||||
pub fn run(client: &Client, args: Args) -> Result<()> {
|
||||
if client.json_mode() {
|
||||
bail!("hive-forge diff: --json is not supported for this verb — a diff is text by nature");
|
||||
}
|
||||
refuse_json(client.json_mode(), "diff", "a diff is text by nature")?;
|
||||
let (owner, name) = client.owner_repo()?;
|
||||
let diff = client
|
||||
.api()
|
||||
|
|
|
|||
Loading…
Reference in a new issue