refactor(hive-forge): port CLI verbs to forgejo-api

This commit is contained in:
müde 2026-07-07 09:24:53 +02:00
commit 4636987469
36 changed files with 1463 additions and 1153 deletions

View file

@ -15,8 +15,9 @@
use anyhow::Result;
use clap::Args as ClapArgs;
use forgejo_api::structs::RepoDownloadPullDiffOrPatchQuery;
use crate::client::Client;
use crate::client::{Client, index};
#[derive(ClapArgs)]
pub struct Args {
@ -31,11 +32,17 @@ pub struct Args {
}
pub fn run(client: &Client, args: Args) -> Result<()> {
let repo = client.repo();
let diff = client.get_text(
&format!("/repos/{repo}/pulls/{}.diff", args.number),
"text/plain",
)?;
let (owner, name) = client.owner_repo()?;
let diff = client
.api()
.repo_download_pull_diff_or_patch(
owner,
name,
index(args.number)?,
"diff",
RepoDownloadPullDiffOrPatchQuery::default(),
)
.send()?;
let out = if args.full {
diff
} else {