use clap::{Args, Subcommand};
use crate::commands::keyring::email::provider::Provider;
use crate::core::observability::Observable;
#[derive(Args, Debug)]
pub struct KeyringArgs {
#[command(subcommand)]
pub command: KeyringCommands,
}
#[derive(Subcommand, Debug)]
pub enum KeyringCommands {
Add(AddArgs),
Modify {
alias: Option<String>,
},
Delete {
alias: String,
},
List,
}
impl Observable for KeyringCommands {
fn command_name(&self) -> &'static str {
match self {
KeyringCommands::Add(_) => "keyring.add",
KeyringCommands::Modify { .. } => "keyring.modify",
KeyringCommands::Delete { .. } => "keyring.delete",
KeyringCommands::List => "keyring.list",
}
}
}
#[derive(Args, Debug)]
pub struct AddArgs {
#[command(subcommand)]
pub kind: Option<AddKind>,
}
#[derive(Subcommand, Debug)]
pub enum AddKind {
Email {
email: String,
#[arg(long)]
alias: Option<String>,
#[arg(long)]
provider: Option<Provider>,
#[arg(long)]
host: Option<String>,
#[arg(long)]
port: Option<u16>,
},
Bucket {
alias: Option<String>,
},
}