use clap::Parser;
use crate::commands;
use crate::{OutputFormat, OutputVersion};
pub const OUTPUT_VERSIONS: &[OutputVersion] = &[OutputVersion::new(0, 11, 0)];
pub const DEFAULT_OUTPUT_VERSION: OutputVersion = OutputVersion::new(0, 11, 0);
#[derive(Parser, Debug)]
#[command(about, author, name = env!("CARGO_BIN_NAME"), version)]
pub struct Cli {
#[arg(long, value_enum, default_value_t = OutputFormat::Text)]
pub output_format: OutputFormat,
#[arg(long, default_value_t = DEFAULT_OUTPUT_VERSION)]
pub output_version: OutputVersion,
#[command(subcommand)]
pub cmd: Command,
}
#[derive(Parser, Debug)]
pub enum Command {
List(commands::list::ListCommand),
Status(commands::status::StatusCommand),
Info(commands::info::InfoCommand),
Ssh(commands::ssh::SshCommand),
Pubkey(commands::pubkey::PubkeyCommand),
Admin(commands::admin::AdminCommand),
#[clap(
long_about = indoc::indoc! { "
PIN management (change PINs, reset blocked PINs)
OpenPGP cards use PINs (numerical passwords) to verify that a user is allowed to \
perform an operation. There are two PINs for regular operation, User PIN and Admin \
PIN, and one optional Resetting Code.
The User PIN is required to use cryptographic operations on a card (such as \
decryption or signing).
The Admin PIN is needed to configure a card (for example to import an OpenPGP key \
into the card) or to unblock the User PIN.
The Resetting Code only allows unblocking the User PIN. This is useful if the user \
doesn't have access to the Admin PIN.
By default, on unconfigured (or factory reset) cards, the User PIN is typically set to
123456, and the Admin PIN is set to 12345678."
},
)]
Pin(commands::pin::PinCommand),
Decrypt(commands::decrypt::DecryptCommand),
Sign(commands::sign::SignCommand),
Attestation(commands::attestation::AttestationCommand),
System(commands::system::SystemCommand),
#[clap(
long_about = indoc::indoc! { "
Show supported output format versions for JSON and YAML output.
Mark the currently chosen one with a star."
}
)]
OutputVersions {},
}