refactor(hive-forge): port CLI verbs to forgejo-api
This commit is contained in:
parent
b8a3927c43
commit
4636987469
36 changed files with 1463 additions and 1153 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue