mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 12:09:33 +01:00
add doc comments to pr commands
This commit is contained in:
parent
2f9c1a0f5d
commit
7214852444
1 changed files with 55 additions and 0 deletions
55
src/prs.rs
55
src/prs.rs
|
@ -17,8 +17,10 @@ use crate::{
|
||||||
|
|
||||||
#[derive(Args, Clone, Debug)]
|
#[derive(Args, Clone, Debug)]
|
||||||
pub struct PrCommand {
|
pub struct PrCommand {
|
||||||
|
/// The git remote to operate on.
|
||||||
#[clap(long, short = 'R')]
|
#[clap(long, short = 'R')]
|
||||||
remote: Option<String>,
|
remote: Option<String>,
|
||||||
|
/// The name of the remote repository to operate on.
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
repo: Option<String>,
|
repo: Option<String>,
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
|
@ -27,34 +29,60 @@ pub struct PrCommand {
|
||||||
|
|
||||||
#[derive(Subcommand, Clone, Debug)]
|
#[derive(Subcommand, Clone, Debug)]
|
||||||
pub enum PrSubcommand {
|
pub enum PrSubcommand {
|
||||||
|
/// Create a new pull request
|
||||||
Create {
|
Create {
|
||||||
|
/// The branch to merge onto.
|
||||||
base: String,
|
base: String,
|
||||||
|
/// The branch to pull changes from.
|
||||||
head: String,
|
head: String,
|
||||||
|
/// What to name the new pull request.
|
||||||
|
///
|
||||||
|
/// Prefix with "WIP: " to mark this PR as a draft.
|
||||||
title: String,
|
title: String,
|
||||||
|
/// The text body of the pull request.
|
||||||
|
///
|
||||||
|
/// Leaving this out will open your editor.
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
body: Option<String>,
|
body: Option<String>,
|
||||||
},
|
},
|
||||||
|
/// Edit the contents of a pull request
|
||||||
Edit {
|
Edit {
|
||||||
|
/// The pull request to edit.
|
||||||
pr: u64,
|
pr: u64,
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
command: EditCommand,
|
command: EditCommand,
|
||||||
},
|
},
|
||||||
|
/// Merge a pull request
|
||||||
Merge {
|
Merge {
|
||||||
|
/// The pull request to merge.
|
||||||
pr: u64,
|
pr: u64,
|
||||||
|
/// The merge style to use.
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
method: Option<MergeMethod>,
|
method: Option<MergeMethod>,
|
||||||
|
/// Option to delete the corresponding branch afterwards.
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
delete: bool,
|
delete: bool,
|
||||||
},
|
},
|
||||||
|
/// Add a comment on a pull request
|
||||||
Comment {
|
Comment {
|
||||||
|
/// The pull request to comment on.
|
||||||
pr: u64,
|
pr: u64,
|
||||||
|
/// The text content of the comment.
|
||||||
|
///
|
||||||
|
/// Not including this in the command will open your editor.
|
||||||
body: Option<String>,
|
body: Option<String>,
|
||||||
},
|
},
|
||||||
|
/// Close a pull request, without merging.
|
||||||
Close {
|
Close {
|
||||||
|
/// The pull request to close.
|
||||||
pr: u64,
|
pr: u64,
|
||||||
|
/// A comment to add before closing.
|
||||||
|
///
|
||||||
|
/// Adding without an argument will open your editor
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
with_msg: Option<Option<String>>,
|
with_msg: Option<Option<String>>,
|
||||||
},
|
},
|
||||||
|
/// Search a repository's pull requests
|
||||||
Search {
|
Search {
|
||||||
query: Option<String>,
|
query: Option<String>,
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
|
@ -66,11 +94,14 @@ pub enum PrSubcommand {
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
state: Option<crate::issues::State>,
|
state: Option<crate::issues::State>,
|
||||||
},
|
},
|
||||||
|
/// View the contents of a pull request
|
||||||
View {
|
View {
|
||||||
|
/// The pull request to view.
|
||||||
id: u64,
|
id: u64,
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
command: Option<ViewCommand>,
|
command: Option<ViewCommand>,
|
||||||
},
|
},
|
||||||
|
/// Checkout a pull request in a new branch
|
||||||
Checkout {
|
Checkout {
|
||||||
/// The pull request to check out.
|
/// The pull request to check out.
|
||||||
///
|
///
|
||||||
|
@ -82,7 +113,11 @@ pub enum PrSubcommand {
|
||||||
#[clap(long, id = "NAME")]
|
#[clap(long, id = "NAME")]
|
||||||
branch_name: Option<String>,
|
branch_name: Option<String>,
|
||||||
},
|
},
|
||||||
|
/// Open a pull request in your browser
|
||||||
Browse {
|
Browse {
|
||||||
|
/// The pull request to open in your browser.
|
||||||
|
///
|
||||||
|
/// Leave this out to open the list of PRs.
|
||||||
id: Option<u64>,
|
id: Option<u64>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -138,26 +173,45 @@ impl From<MergeMethod> for forgejo_api::structs::MergePullRequestOptionDo {
|
||||||
|
|
||||||
#[derive(Subcommand, Clone, Debug)]
|
#[derive(Subcommand, Clone, Debug)]
|
||||||
pub enum EditCommand {
|
pub enum EditCommand {
|
||||||
|
/// Edit the title
|
||||||
Title {
|
Title {
|
||||||
|
/// New PR title.
|
||||||
|
///
|
||||||
|
/// Leaving this out will open the current title in your editor.
|
||||||
new_title: Option<String>,
|
new_title: Option<String>,
|
||||||
},
|
},
|
||||||
|
/// Edit the text body
|
||||||
Body {
|
Body {
|
||||||
|
/// New PR body.
|
||||||
|
///
|
||||||
|
/// Leaving this out will open the current body in your editor.
|
||||||
new_body: Option<String>,
|
new_body: Option<String>,
|
||||||
},
|
},
|
||||||
|
/// Edit a comment
|
||||||
Comment {
|
Comment {
|
||||||
|
/// The index of the comment to edit, 0-indexed.
|
||||||
idx: usize,
|
idx: usize,
|
||||||
|
/// New comment body.
|
||||||
|
///
|
||||||
|
/// Leaving this out will open the current body in your editor.
|
||||||
new_body: Option<String>,
|
new_body: Option<String>,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand, Clone, Debug)]
|
#[derive(Subcommand, Clone, Debug)]
|
||||||
pub enum ViewCommand {
|
pub enum ViewCommand {
|
||||||
|
/// View the title and body of a pull request.
|
||||||
Body,
|
Body,
|
||||||
|
/// View a comment on a pull request.
|
||||||
Comment {
|
Comment {
|
||||||
|
/// The index of the comment to view, 0-indexed.
|
||||||
idx: usize,
|
idx: usize,
|
||||||
},
|
},
|
||||||
|
/// View all comments on a pull request.
|
||||||
Comments,
|
Comments,
|
||||||
|
/// View the labels applied to a pull request.
|
||||||
Labels,
|
Labels,
|
||||||
|
/// View the diff between the base and head branches of a pull request.
|
||||||
Diff {
|
Diff {
|
||||||
/// Get the diff in patch format
|
/// Get the diff in patch format
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
|
@ -166,6 +220,7 @@ pub enum ViewCommand {
|
||||||
#[clap(long, short)]
|
#[clap(long, short)]
|
||||||
editor: bool,
|
editor: bool,
|
||||||
},
|
},
|
||||||
|
/// View the files changed in a pull request.
|
||||||
Files,
|
Files,
|
||||||
Commits {
|
Commits {
|
||||||
/// View one commit per line
|
/// View one commit per line
|
||||||
|
|
Loading…
Reference in a new issue