Watch
0
0
Fork
You've already forked hyperhive
0

hive-forge: add body to pr show --json, error --json on six verbs that silently ignored it

This commit is contained in:
damocles 2026-10-04 08:04:19 +02:00
commit e0ad3a567b
6 changed files with 25 additions and 4 deletions

View file

@ -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()

View file

@ -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,

View file

@ -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()

View file

@ -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,

View file

@ -1,7 +1,7 @@
//! `tree-sha <ref> [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".

View file

@ -1,7 +1,7 @@
//! `view <number> [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.