diff options
author | Cyborus <cyborus@cyborus.xyz> | 2023-12-13 01:49:13 +0100 |
---|---|---|
committer | Cyborus <cyborus@cyborus.xyz> | 2023-12-13 02:06:20 +0100 |
commit | 68d255db7a04c4b62e1c638e625a985432f2a7f9 (patch) | |
tree | e72810c41b7ca3b359f654692e7216a9a3524477 /src/main.rs | |
parent | Merge pull request 'add ci' (#8) from ci into main (diff) | |
download | forgejo-cli-68d255db7a04c4b62e1c638e625a985432f2a7f9.tar.xz forgejo-cli-68d255db7a04c4b62e1c638e625a985432f2a7f9.zip |
add git remote selection flag
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index c7674d0..1445706 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,8 @@ mod repo; #[derive(Parser, Debug)] pub struct App { + #[clap(long, short='R')] + remote: Option<String>, #[clap(subcommand)] command: Command, } @@ -36,13 +38,13 @@ async fn main() -> eyre::Result<()> { let mut keys = KeyInfo::load().await?; match args.command { - Command::Repo(subcommand) => subcommand.run(&keys).await?, - Command::Issue(subcommand) => subcommand.run(&keys).await?, + Command::Repo(subcommand) => subcommand.run(&keys, args.remote.as_deref()).await?, + Command::Issue(subcommand) => subcommand.run(&keys, args.remote.as_deref()).await?, Command::User { host } => { let host = host.map(|host| Url::parse(&host)).transpose()?; let url = match host { Some(url) => url, - None => repo::RepoInfo::get_current()?.url().clone(), + None => repo::RepoInfo::get_current(args.remote.as_deref())?.url().clone(), }; let name = keys.get_login(&url)?.username(); eprintln!("currently signed in to {name}@{url}"); |