mod export;
mod generate;
mod import;
mod list;
use self::{
export::ExportCommand, generate::GenerateCommand, import::ImportCommand, list::ListCommand,
};
use abscissa_core::{Command, Runnable};
use clap::Subcommand;
use std::path::PathBuf;
pub const DEFAULT_DOMAINS: yubihsm::Domain = yubihsm::Domain::DOM1;
pub const DEFAULT_WRAP_KEY: yubihsm::object::Id = 1;
#[derive(Command, Debug, Subcommand, Runnable)]
pub enum KeysCommand {
Export(ExportCommand),
Generate(GenerateCommand),
Import(ImportCommand),
List(ListCommand),
}
impl KeysCommand {
pub(super) fn config_path(&self) -> Option<&PathBuf> {
match self {
KeysCommand::Export(export) => export.config.as_ref(),
KeysCommand::Generate(generate) => generate.config.as_ref(),
KeysCommand::List(list) => list.config.as_ref(),
KeysCommand::Import(import) => import.config.as_ref(),
}
}
}