pub mod cli;
pub mod complete;
use clap::{Parser, Subcommand};
use clap_complete::engine::ArgValueCompleter;
use crate::complete::complete_serials;
pub fn command() -> clap::Command {
use clap::CommandFactory as _;
Cli::command()
}
#[derive(Parser, Debug)]
#[command(name = "yb", about = "Secure blob storage on a YubiKey", version)]
pub struct Cli {
#[arg(short = 's', long = "serial", add = ArgValueCompleter::new(complete_serials))]
pub serial: Option<u32>,
#[arg(short = 'r', long = "reader")]
pub reader: Option<String>,
#[arg(short = 'q', long = "quiet")]
pub quiet: bool,
#[arg(long = "pin-stdin")]
pub pin_stdin: bool,
#[arg(long = "debug")]
pub debug: bool,
#[arg(long = "allow-defaults")]
pub allow_defaults: bool,
#[arg(long = "allow-low-pin-attempts")]
pub allow_low_pin_attempts: bool,
#[arg(long = "pin", hide = true)]
pub pin_removed: Option<String>,
#[arg(short = 'k', long = "key", hide = true)]
pub key_removed: Option<String>,
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand, Debug)]
pub enum Commands {
Format(cli::format::FormatArgs),
Store(cli::store::StoreArgs),
Fetch(cli::fetch::FetchArgs),
#[command(alias = "ls")]
List(cli::list::ListArgs),
#[command(alias = "rm")]
Remove(cli::remove::RemoveArgs),
Fsck(cli::fsck::FsckArgs),
RotateManagementKey(cli::rotate_management_key::RotateManagementKeyArgs),
ManagementKey(cli::management_key::ManagementKeyArgs),
ListReaders(cli::list_readers::ListReadersArgs),
Select(cli::select::SelectArgs),
#[cfg(feature = "self-test")]
SelfTest(cli::self_test::SelfTestArgs),
}