add command line options to specify output format, version
In this change, these have no effect, but they will have soon. Very soon. Sponsored-by: NLnet Foundation; NGI Assure
This commit is contained in:
parent
eb0ad179f6
commit
dd6950e5fe
1 changed files with 18 additions and 0 deletions
|
@ -4,6 +4,12 @@
|
||||||
use clap::{AppSettings, Parser};
|
use clap::{AppSettings, Parser};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use crate::{OutputFormat, OutputVersion};
|
||||||
|
|
||||||
|
pub const DEFAULT_OUTPUT_VERSION: &str = "1.0.0";
|
||||||
|
pub const OUTPUT_VERSIONS: &[OutputVersion] =
|
||||||
|
&[OutputVersion::new(0, 0, 0), OutputVersion::new(1, 0, 0)];
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[clap(
|
#[clap(
|
||||||
name = "opgpcard",
|
name = "opgpcard",
|
||||||
|
@ -13,12 +19,24 @@ use std::path::PathBuf;
|
||||||
about = "A tool for inspecting and configuring OpenPGP cards."
|
about = "A tool for inspecting and configuring OpenPGP cards."
|
||||||
)]
|
)]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
|
/// Produce output in the chosen format.
|
||||||
|
#[clap(long, value_enum, default_value = "text")]
|
||||||
|
pub output_format: OutputFormat,
|
||||||
|
|
||||||
|
/// Pick output version to use, for non-textual formats.
|
||||||
|
#[clap(long, default_value = DEFAULT_OUTPUT_VERSION)]
|
||||||
|
pub output_version: OutputVersion,
|
||||||
|
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
pub cmd: Command,
|
pub cmd: Command,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
|
/// Show all output versions that are supported. Mark the
|
||||||
|
/// currently chosen one with a star.
|
||||||
|
OutputVersions {},
|
||||||
|
|
||||||
/// Enumerate available OpenPGP cards
|
/// Enumerate available OpenPGP cards
|
||||||
List {},
|
List {},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue