docs: better clap ids

This commit is contained in:
Cyborus 2024-07-30 18:10:11 -04:00
parent 54fc89cd16
commit 227a2207fb
No known key found for this signature in database
4 changed files with 24 additions and 4 deletions

View file

@ -23,25 +23,28 @@ pub enum IssueSubcommand {
title: String, title: String,
#[clap(long)] #[clap(long)]
body: Option<String>, body: Option<String>,
#[clap(long, short)] #[clap(long, short, id = "[HOST/]OWNER/REPO")]
repo: Option<RepoArg>, repo: Option<RepoArg>,
}, },
Edit { Edit {
#[clap(id = "[REPO#]ID")]
issue: IssueId, issue: IssueId,
#[clap(subcommand)] #[clap(subcommand)]
command: EditCommand, command: EditCommand,
}, },
Comment { Comment {
#[clap(id = "[REPO#]ID")]
issue: IssueId, issue: IssueId,
body: Option<String>, body: Option<String>,
}, },
Close { Close {
#[clap(id = "[REPO#]ID")]
issue: IssueId, issue: IssueId,
#[clap(long, short)] #[clap(long, short)]
with_msg: Option<Option<String>>, with_msg: Option<Option<String>>,
}, },
Search { Search {
#[clap(long, short)] #[clap(long, short, id = "[HOST/]OWNER/REPO")]
repo: Option<RepoArg>, repo: Option<RepoArg>,
query: Option<String>, query: Option<String>,
#[clap(long, short)] #[clap(long, short)]
@ -54,11 +57,13 @@ pub enum IssueSubcommand {
state: Option<State>, state: Option<State>,
}, },
View { View {
#[clap(id = "[REPO#]ID")]
id: IssueId, id: IssueId,
#[clap(subcommand)] #[clap(subcommand)]
command: Option<ViewCommand>, command: Option<ViewCommand>,
}, },
Browse { Browse {
#[clap(id = "[REPO#]ID")]
id: IssueId, id: IssueId,
}, },
} }

View file

@ -60,12 +60,13 @@ pub enum PrSubcommand {
#[clap(long)] #[clap(long)]
body: Option<String>, body: Option<String>,
/// The repo to create this issue on /// The repo to create this issue on
#[clap(long, short)] #[clap(long, short, id = "[HOST/]OWNER/REPO")]
repo: Option<RepoArg>, repo: Option<RepoArg>,
}, },
/// View the contents of a pull request /// View the contents of a pull request
View { View {
/// The pull request to view. /// The pull request to view.
#[clap(id = "[REPO#]ID")]
id: Option<IssueId>, id: Option<IssueId>,
#[clap(subcommand)] #[clap(subcommand)]
command: Option<ViewCommand>, command: Option<ViewCommand>,
@ -73,6 +74,7 @@ pub enum PrSubcommand {
/// View the mergability and CI status of a pull request /// View the mergability and CI status of a pull request
Status { Status {
/// The pull request to view. /// The pull request to view.
#[clap(id = "[REPO#]ID")]
id: Option<IssueId>, id: Option<IssueId>,
}, },
/// Checkout a pull request in a new branch /// Checkout a pull request in a new branch
@ -80,6 +82,7 @@ pub enum PrSubcommand {
/// The pull request to check out. /// The pull request to check out.
/// ///
/// Prefix with ^ to get a pull request from the parent repo. /// Prefix with ^ to get a pull request from the parent repo.
#[clap(id = "ID")]
pr: PrNumber, pr: PrNumber,
/// The name to give the newly created branch. /// The name to give the newly created branch.
/// ///
@ -90,6 +93,7 @@ pub enum PrSubcommand {
/// Add a comment on a pull request /// Add a comment on a pull request
Comment { Comment {
/// The pull request to comment on. /// The pull request to comment on.
#[clap(id = "[REPO#]ID")]
pr: Option<IssueId>, pr: Option<IssueId>,
/// The text content of the comment. /// The text content of the comment.
/// ///
@ -99,6 +103,7 @@ pub enum PrSubcommand {
/// Edit the contents of a pull request /// Edit the contents of a pull request
Edit { Edit {
/// The pull request to edit. /// The pull request to edit.
#[clap(id = "[REPO#]ID")]
pr: Option<IssueId>, pr: Option<IssueId>,
#[clap(subcommand)] #[clap(subcommand)]
command: EditCommand, command: EditCommand,
@ -106,6 +111,7 @@ pub enum PrSubcommand {
/// Close a pull request, without merging. /// Close a pull request, without merging.
Close { Close {
/// The pull request to close. /// The pull request to close.
#[clap(id = "[REPO#]ID")]
pr: Option<IssueId>, pr: Option<IssueId>,
/// A comment to add before closing. /// A comment to add before closing.
/// ///
@ -116,6 +122,7 @@ pub enum PrSubcommand {
/// Merge a pull request /// Merge a pull request
Merge { Merge {
/// The pull request to merge. /// The pull request to merge.
#[clap(id = "[REPO#]ID")]
pr: Option<IssueId>, pr: Option<IssueId>,
/// The merge style to use. /// The merge style to use.
#[clap(long, short = 'M')] #[clap(long, short = 'M')]
@ -133,6 +140,7 @@ pub enum PrSubcommand {
/// Open a pull request in your browser /// Open a pull request in your browser
Browse { Browse {
/// The pull request to open in your browser. /// The pull request to open in your browser.
#[clap(id = "[REPO#]ID")]
id: Option<IssueId>, id: Option<IssueId>,
}, },
} }

View file

@ -16,7 +16,7 @@ use crate::{
pub struct ReleaseCommand { pub struct ReleaseCommand {
#[clap(long, short = 'R')] #[clap(long, short = 'R')]
remote: Option<String>, remote: Option<String>,
#[clap(long, short)] #[clap(long, short, id = "[HOST/]OWNER/REPO")]
repo: Option<RepoArg>, repo: Option<RepoArg>,
#[clap(subcommand)] #[clap(subcommand)]
command: ReleaseSubcommand, command: ReleaseSubcommand,

View file

@ -305,6 +305,7 @@ pub enum RepoCommand {
push: bool, push: bool,
}, },
Fork { Fork {
#[clap(id = "[HOST/]OWNER/REPO")]
repo: RepoArg, repo: RepoArg,
#[clap(long)] #[clap(long)]
name: Option<String>, name: Option<String>,
@ -312,24 +313,30 @@ pub enum RepoCommand {
remote: Option<String>, remote: Option<String>,
}, },
View { View {
#[clap(id = "[HOST/]OWNER/REPO")]
name: Option<RepoArg>, name: Option<RepoArg>,
#[clap(long, short = 'R')] #[clap(long, short = 'R')]
remote: Option<String>, remote: Option<String>,
}, },
Clone { Clone {
#[clap(id = "[HOST/]OWNER/REPO")]
repo: RepoArg, repo: RepoArg,
path: Option<PathBuf>, path: Option<PathBuf>,
}, },
Star { Star {
#[clap(id = "[HOST/]OWNER/REPO")]
repo: RepoArg, repo: RepoArg,
}, },
Unstar { Unstar {
#[clap(id = "[HOST/]OWNER/REPO")]
repo: RepoArg, repo: RepoArg,
}, },
Delete { Delete {
#[clap(id = "[HOST/]OWNER/REPO")]
repo: RepoArg, repo: RepoArg,
}, },
Browse { Browse {
#[clap(id = "[HOST/]OWNER/REPO")]
name: Option<RepoArg>, name: Option<RepoArg>,
#[clap(long, short = 'R')] #[clap(long, short = 'R')]
remote: Option<String>, remote: Option<String>,