Make sq network dane generate
require cert designators or --all
.
- Fixes #476.
This commit is contained in:
parent
7397a8a440
commit
98203e6cd0
@ -8,7 +8,7 @@ use crate::cli::types::FileOrStdout;
|
||||
use crate::cli::types::cert_designator::{
|
||||
CertDesignators,
|
||||
CertUserIDEmailFileArgs,
|
||||
OptionalValue,
|
||||
CertOrAll,
|
||||
CertPrefix,
|
||||
};
|
||||
|
||||
@ -103,7 +103,7 @@ pub struct GenerateCommand {
|
||||
#[command(flatten)]
|
||||
pub certs: CertDesignators<CertUserIDEmailFileArgs,
|
||||
CertPrefix,
|
||||
OptionalValue>,
|
||||
CertOrAll>,
|
||||
|
||||
#[clap(
|
||||
long = "all",
|
||||
|
@ -233,6 +233,12 @@ pub type FileRequiresOutput = typenum::U4;
|
||||
pub type OneValueAndFileRequiresOutput
|
||||
= <OneValue as BitOr<FileRequiresOutput>>::Output;
|
||||
|
||||
/// Require either a cert designator, or the `all` parameter.
|
||||
///
|
||||
/// Note: the `all` parameter is not part of the cert designators
|
||||
/// argument, but must be explicitly added.
|
||||
pub type CertOrAll = typenum::U8;
|
||||
|
||||
// Additional documentation.
|
||||
|
||||
/// The prefix for the designators.
|
||||
@ -541,6 +547,7 @@ where
|
||||
let optional_value = (options & OptionalValue::to_usize()) > 0;
|
||||
let file_requires_output =
|
||||
(options & FileRequiresOutput::to_usize()) > 0;
|
||||
let cert_or_all = (options & CertOrAll::to_usize()) > 0;
|
||||
|
||||
let group = format!("cert-designator-{}-{:X}-{:X}",
|
||||
Prefix::name(),
|
||||
@ -559,6 +566,10 @@ where
|
||||
arg_group = arg_group.required(true);
|
||||
}
|
||||
|
||||
if cert_or_all {
|
||||
arg_group = arg_group.arg("all");
|
||||
}
|
||||
|
||||
let action = if one_value {
|
||||
clap::ArgAction::Set
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user