From 839a63bb3988403b65134226f7de376109e15d9a Mon Sep 17 00:00:00 2001 From: Cyborus Date: Mon, 17 Jun 2024 22:13:15 -0400 Subject: [PATCH] chore: `user.rs` file --- src/main.rs | 3 +++ src/user.rs | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/user.rs diff --git a/src/main.rs b/src/main.rs index 4b3f852..48c2b03 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,7 @@ mod issues; mod prs; mod release; mod repo; +mod user; #[derive(Parser, Debug)] pub struct App { @@ -37,6 +38,7 @@ pub enum Command { #[clap(subcommand)] Auth(auth::AuthCommand), Release(release::ReleaseCommand), + User(user::UserCommand), Version { /// Checks for updates #[clap(long)] @@ -76,6 +78,7 @@ async fn main() -> eyre::Result<()> { } Command::Auth(subcommand) => subcommand.run(&mut keys, host_name).await?, Command::Release(subcommand) => subcommand.run(&mut keys, host_name).await?, + Command::User(subcommand) => subcommand.run(&mut keys, host_name).await?, Command::Version { #[cfg(feature = "update-check")] check, diff --git a/src/user.rs b/src/user.rs new file mode 100644 index 0000000..0adceff --- /dev/null +++ b/src/user.rs @@ -0,0 +1,23 @@ +use clap::{Args, Subcommand}; + +use crate::repo::RepoInfo; + +#[derive(Args, Clone, Debug)] +pub struct UserCommand { + #[clap(long, short = 'R')] + remote: Option, + #[clap(subcommand)] + command: UserSubcommand, +} + +#[derive(Subcommand, Clone, Debug)] +pub enum UserSubcommand {} + +impl UserCommand { + pub async fn run(self, keys: &mut crate::KeyInfo, host_name: Option<&str>) -> eyre::Result<()> { + let repo = RepoInfo::get_current(host_name, None, self.remote.as_deref())?; + let api = keys.get_api(repo.host_url()).await?; + match self.command {} + Ok(()) + } +}