hive-forge: global -r/--repo flag instead of per-verb [repo] positional (mara@#407)

This commit is contained in:
damocles 2026-05-25 02:12:04 +02:00 committed by Mara
commit badf21714b
21 changed files with 46 additions and 85 deletions

View file

@ -1,6 +1,6 @@
//! `attach-issue <number> <file> [repo]` and `attach-comment
//! <comment-id> <file> [repo]` — upload a file as an attachment.
//! Prints the browser download URL.
//! `attach-issue <number> <file>` and `attach-comment <comment-id>
//! <file>` — upload a file as an attachment. Prints the browser
//! download URL.
use std::path::PathBuf;
@ -16,8 +16,6 @@ pub struct IssueArgs {
number: u64,
/// File path to upload.
file: PathBuf,
/// Repo override.
repo: Option<String>,
}
#[derive(ClapArgs)]
@ -26,8 +24,6 @@ pub struct CommentArgs {
id: u64,
/// File path to upload.
file: PathBuf,
/// Repo override.
repo: Option<String>,
}
pub fn run_issue(client: &Client, args: IssueArgs) -> Result<()> {
@ -37,7 +33,7 @@ pub fn run_issue(client: &Client, args: IssueArgs) -> Result<()> {
args.file.display()
);
}
let repo = client.repo(args.repo.as_deref());
let repo = client.repo();
let resp = client.post_multipart_file(
&format!("/repos/{repo}/issues/{}/assets", args.number),
&args.file,
@ -53,7 +49,7 @@ pub fn run_comment(client: &Client, args: CommentArgs) -> Result<()> {
args.file.display()
);
}
let repo = client.repo(args.repo.as_deref());
let repo = client.repo();
let resp = client.post_multipart_file(
&format!("/repos/{repo}/issues/comments/{}/assets", args.id),
&args.file,