mod login;
use clap::Subcommand;
use anyhow::Result;
use log::info;
use crate::command::login::login;
#[derive(Debug, PartialEq, Subcommand)]
pub enum Command {
#[clap(name = "login", alias = "adduser", alias = "add-user")]
Login {
#[clap(long = "registry", short = 'r')]
registry: Option<String>,
#[clap(long = "scope", short = 's')]
scope: Option<String>,
#[clap(long = "auth-type", short = 't')]
auth_type: Option<String>,
},
}
pub fn run_pack(command: Command) -> Result<()> {
match command {
Command::Login {
registry,
scope,
auth_type,
} => {
info!("Running login command...");
info!(
"Registry: {:?}, Scope: {:?}, Auth Type: {:?}",
®istry, &scope, &auth_type
);
login(registry, &scope, &auth_type)
}
_ => {
Ok(())
}
}
}