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
|
|
@ -1,13 +1,13 @@
|
|||
//! `view <number> [repo]` — dump title + body + all comments as
|
||||
//! markdown.
|
||||
|
||||
use anyhow::{Result, bail};
|
||||
use anyhow::Result;
|
||||
use clap::Args as ClapArgs;
|
||||
use forgejo_api::structs::{IssueGetCommentsQuery, StateType};
|
||||
|
||||
use crate::client::{Client, index};
|
||||
use crate::notify;
|
||||
use crate::verbs::{attachment_line, issue_reactions, reaction_summary};
|
||||
use crate::verbs::{attachment_line, issue_reactions, reaction_summary, refuse_json};
|
||||
|
||||
#[derive(ClapArgs)]
|
||||
pub struct Args {
|
||||
|
|
@ -16,12 +16,11 @@ pub struct Args {
|
|||
}
|
||||
|
||||
pub fn run(client: &Client, args: Args) -> Result<()> {
|
||||
if client.json_mode() {
|
||||
bail!(
|
||||
"hive-forge view: --json is not supported for this verb — \
|
||||
use `issue show`/`pr show` for structured fields"
|
||||
);
|
||||
}
|
||||
refuse_json(
|
||||
client.json_mode(),
|
||||
"view",
|
||||
"use `issue show`/`pr show` for structured fields",
|
||||
)?;
|
||||
let repo = client.repo()?;
|
||||
// Reading the thread clears its unread notification so the
|
||||
// read-before-comment guard (in `comment`) lets a reply through.
|
||||
|
|
|
|||
Loading…
Reference in a new issue