diff --git a/hive-forge/src/verbs/branches.rs b/hive-forge/src/verbs/branches.rs index 5973c14f..849088ca 100644 --- a/hive-forge/src/verbs/branches.rs +++ b/hive-forge/src/verbs/branches.rs @@ -1,6 +1,6 @@ //! `branches [pattern] [repo]` — list branches, optionally filtered. -use anyhow::Result; +use anyhow::{Result, bail}; use clap::Args as ClapArgs; use crate::client::Client; @@ -12,6 +12,11 @@ pub struct Args { } pub fn run(client: &Client, args: Args) -> Result<()> { + if client.json_mode() { + bail!( + "hive-forge branches: --json is not supported for this verb, only the plain name list" + ); + } let (owner, name) = client.owner_repo()?; let (_, branches) = client .api() diff --git a/hive-forge/src/verbs/clone.rs b/hive-forge/src/verbs/clone.rs index 9a89b71f..c597eee2 100644 --- a/hive-forge/src/verbs/clone.rs +++ b/hive-forge/src/verbs/clone.rs @@ -39,6 +39,9 @@ pub struct Args { /// Returns an error if the `git clone` shellout fails (bad repo, auth /// rejected, network) or the destination can't be derived. pub fn run(client: &Client, args: Args) -> Result<()> { + if client.json_mode() { + bail!("hive-forge clone: --json is not supported for this verb, only the destination path"); + } let repo = client.repo()?; let dest = match args.dest { Some(d) => d, diff --git a/hive-forge/src/verbs/diff.rs b/hive-forge/src/verbs/diff.rs index d38fb804..6a30104c 100644 --- a/hive-forge/src/verbs/diff.rs +++ b/hive-forge/src/verbs/diff.rs @@ -13,7 +13,7 @@ //! lockfile without any information the reader can act on. //! Pass `--full` to dump the unfiltered diff. -use anyhow::Result; +use anyhow::{Result, bail}; use clap::Args as ClapArgs; use forgejo_api::structs::RepoDownloadPullDiffOrPatchQuery; @@ -31,6 +31,9 @@ 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"); + } let (owner, name) = client.owner_repo()?; let diff = client .api() diff --git a/hive-forge/src/verbs/pr.rs b/hive-forge/src/verbs/pr.rs index 3cb90d45..a174d6d8 100644 --- a/hive-forge/src/verbs/pr.rs +++ b/hive-forge/src/verbs/pr.rs @@ -31,6 +31,7 @@ pub fn run(client: &Client, args: Args) -> Result<()> { "head_sha": pull.head.as_ref().and_then(|h| h.sha.as_deref()), "head_branch": pull.head.as_ref().and_then(|h| h.label.as_deref()), "base_branch": pull.base.as_ref().and_then(|b| b.label.as_deref()), + "body": pull.body, "dependencies": dependencies, "blocking": blocking, "reactions": reactions, diff --git a/hive-forge/src/verbs/tree_sha.rs b/hive-forge/src/verbs/tree_sha.rs index bcce245d..38641893 100644 --- a/hive-forge/src/verbs/tree_sha.rs +++ b/hive-forge/src/verbs/tree_sha.rs @@ -1,7 +1,7 @@ //! `tree-sha [repo]` — print the tree SHA of the commit at a //! branch name or commit SHA. -use anyhow::Result; +use anyhow::{Result, bail}; use clap::Args as ClapArgs; use forgejo_api::structs::RepoGetSingleCommitQuery; @@ -14,6 +14,9 @@ pub struct Args { } pub fn run(client: &Client, args: Args) -> Result<()> { + if client.json_mode() { + bail!("hive-forge tree-sha: --json is not supported for this verb, only the plain sha"); + } let (owner, name) = client.owner_repo()?; // Try branch first; the bash helper silently treats failure as // "not a branch, use the reference as a commit sha directly". diff --git a/hive-forge/src/verbs/view.rs b/hive-forge/src/verbs/view.rs index 8cc19e01..396b180c 100644 --- a/hive-forge/src/verbs/view.rs +++ b/hive-forge/src/verbs/view.rs @@ -1,7 +1,7 @@ //! `view [repo]` — dump title + body + all comments as //! markdown. -use anyhow::Result; +use anyhow::{Result, bail}; use clap::Args as ClapArgs; use forgejo_api::structs::{IssueGetCommentsQuery, StateType}; @@ -16,6 +16,12 @@ 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" + ); + } let repo = client.repo()?; // Reading the thread clears its unread notification so the // read-before-comment guard (in `comment`) lets a reply through.