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(()) + } +}