summaryrefslogtreecommitdiffstats
path: root/src/prs.rs
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2024-06-25 15:48:06 +0200
committerCyborus <cyborus@cyborus.xyz>2024-07-09 01:54:55 +0200
commitfd829a5685d217384b5f71a3451523faf4c4b1be (patch)
treebe710fb226344effbe81d73ebfbd07e5ee2251e0 /src/prs.rs
parentMerge pull request 'add user commands' (#86) from user-commands into main (diff)
downloadforgejo-cli-fd829a5685d217384b5f71a3451523faf4c4b1be.tar.xz
forgejo-cli-fd829a5685d217384b5f71a3451523faf4c4b1be.zip
refactor: `RepoArg` struct for repo name arguments
Diffstat (limited to 'src/prs.rs')
-rw-r--r--src/prs.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/prs.rs b/src/prs.rs
index 6ad6cad..0a46296 100644
--- a/src/prs.rs
+++ b/src/prs.rs
@@ -12,7 +12,7 @@ use forgejo_api::{
use crate::{
issues::IssueId,
- repo::{RepoInfo, RepoName},
+ repo::{RepoArg, RepoInfo, RepoName},
SpecialRender,
};
@@ -40,7 +40,7 @@ pub enum PrSubcommand {
state: Option<crate::issues::State>,
/// The repo to search in
#[clap(long, short)]
- repo: Option<String>,
+ repo: Option<RepoArg>,
},
/// Create a new pull request
Create {
@@ -59,7 +59,7 @@ pub enum PrSubcommand {
body: Option<String>,
/// The repo to create this issue on
#[clap(long, short)]
- repo: Option<String>,
+ repo: Option<RepoArg>,
},
/// View the contents of a pull request
View {
@@ -345,17 +345,17 @@ impl PrCommand {
Ok(())
}
- fn repo(&self) -> Option<&str> {
+ fn repo(&self) -> Option<&RepoArg> {
use PrSubcommand::*;
match &self.command {
- Search { repo, .. } | Create { repo, .. } => repo.as_deref(),
+ Search { repo, .. } | Create { repo, .. } => repo.as_ref(),
Checkout { .. } => None,
View { id: pr, .. }
| Comment { pr, .. }
| Edit { pr, .. }
| Close { pr, .. }
| Merge { pr, .. }
- | Browse { id: pr } => pr.as_ref().and_then(|x| x.repo.as_deref()),
+ | Browse { id: pr } => pr.as_ref().and_then(|x| x.repo.as_ref()),
}
}