mod config;
mod import;
mod list;
mod verify;
use clap::{Parser, ValueEnum};
use clap_verbosity_flag::Verbosity;
pub use config::ConfigCommand;
use import::ImportCommand;
use list::ListCommand;
use crate::cli::verify::VerifyCommand;
#[derive(Clone, Debug, Default, strum::Display, ValueEnum)]
#[strum(serialize_all = "kebab-case")]
pub enum OutputFormat {
Json,
#[default]
Text,
}
#[derive(Debug, Parser)]
#[command(
about = "Command line interface for interacting with VOA hierarchies",
author,
long_about = None,
version,
)]
pub struct Cli {
#[command(flatten)]
pub verbosity: Verbosity,
#[command(subcommand)]
pub command: Command,
}
#[derive(Debug, Parser)]
#[command(about, author, version)]
pub enum Command {
#[command(
about = "Interact with the VOA configuration for technology backends.",
subcommand
)]
Config(ConfigCommand),
#[command(
about = "Import a single verifier into a VOA hierarchy.",
long_about = r#"Import a single verifier into a VOA hierarchy.
By default a single verifier is expected on stdin.
Using the "-i"/"--input" option a specific directory or file can be selected for import instead.
The verifier is written to the user's writable, persistent VOA load path, e.g.:
- "~/.config/voa/": for users with uid >= 1000.
Note, that "voa import" respects the XDG Base Directory Specification and the "XDG_CONFIG_HOME" environment variable.
The above serves as default example.
- "/etc/voa/": for users with uid < 1000
When using the "-r"/"--runtime" option, the verifier is written to the user's writable, ephemeral VOA load path instead, e.g.:
- "/run/user/$(id -u)/voa/": for users with uid >= 1000.
Note, that "voa import" respects the XDG Base Directory Specification and the "XDG_RUNTIME_DIR" environment variable.
The above serves as default example.
- "/run/voa": for users with uid < 1000
The verifier can be written to another, specific VOA base path using the "-b"/"--base-path" option."#
)]
Import(ImportCommand),
#[command(
about = "List all verifiers in VOA that match provided identifiers.",
long_about = r#"List all verifiers in VOA that match provided identifiers.
By default the "os" and "purpose" identifiers have to be provided for a search.
Optionally, the "context" and "technology" identifier can be provided for more fine-grained search results.
"#
)]
List(ListCommand),
#[command(
about = "Verify a file using suitable verifiers and signatures.",
long_about = "Verify a file using suitable verifiers and signatures.
Returns a status message on stdout.
Returns a non-zero exit code and an error message on stderr, if the verification of one or more signature files fails."
)]
Verify(VerifyCommand),
}