Make it possible to hide parts of an example.

- Sometimes an example needs an argument to run in an automated way,
    but which the user shouldn't actually use, like
    `--without-password`.

  - Add a mechanism to hide specific arguments.
This commit is contained in:
Malte Meiboom 2024-12-03 10:37:13 +01:00 committed by Neal H. Walfield
parent f6b4b31976
commit ae0609006c
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3
46 changed files with 175 additions and 6 deletions

View File

@ -14,6 +14,7 @@ const EXAMPLES: Actions = Actions {
command: &[
"sq", "cert", "import", "juliet.pgp",
],
hide: &[],
}),
]
};

View File

@ -87,6 +87,7 @@ Gather statistics on the certificates in a keyring.",
"sq", "cert", "lint",
"--cert-file", "certs.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -98,6 +99,7 @@ Fix a key with known problems.",
"|", "sq", "cert", "lint", "--fix", "--cert-file=-",
"|", "sq", "cert", "import"
],
hide: &[],
}),
],
};

View File

@ -29,6 +29,7 @@ example.org, and that can be authenticated.",
command: &[
"sq", "cert", "list", "@example.org",
],
hide: &[],
})
]
};

View File

@ -31,6 +31,7 @@ List all configuration options.",
command: &[
"sq", "config", "get",
],
hide: &[],
}),
Action::Example(Example {
@ -39,6 +40,7 @@ Get the default cipher suite for key generation.",
command: &[
"sq", "config", "get", "key.generate.cipher-suite",
],
hide: &[],
}),
]
};

View File

@ -65,6 +65,7 @@ Set the default cipher suite for key generation.",
"sq", "config", "set", "key.generate.cipher-suite",
"rsa3k",
],
hide: &[],
}),
Action::Example(Example {
@ -74,6 +75,7 @@ Delete the default cipher suite for key generation.",
"sq", "config", "set", "key.generate.cipher-suite",
"--delete",
],
hide: &[],
}),
Action::Example(Example {
@ -83,6 +85,7 @@ Add a default key server for network queries.",
"sq", "config", "set", "network.keyservers",
"--add", "hkps://keys.example.org",
],
hide: &[],
}),
]
};

View File

@ -36,6 +36,7 @@ Write a template configuration.",
command: &[
"sq", "config", "template",
],
hide: &[],
}),
]
};

View File

@ -25,6 +25,7 @@ Decrypt a file using a secret key",
"sq", "decrypt",
"--recipient-file", "juliet-secret.pgp", "ciphertext.pgp",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -35,6 +36,7 @@ Decrypt a file verifying signatures",
"--signer-file", "romeo.pgp",
"ciphertext.pgp"
],
hide: &[],
}),
Action::Setup(Setup {
command: &[
@ -47,6 +49,7 @@ Decrypt a file using the key store",
command: &[
"sq", "decrypt", "ciphertext.pgp",
],
hide: &[],
}),
]
};

View File

@ -29,6 +29,7 @@ Download and verify the Debian 12 checksum file.",
"--signer=DF9B9C49EAA9298432589D76DA87E80D6294BE9B",
"--output=SHA512SUMS",
],
hide: &[],
}),
]
};

View File

@ -33,6 +33,7 @@ Encrypt a file for a recipient given by fingerprint.",
"--for", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"document.txt",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -41,6 +42,7 @@ Encrypt a file for a recipient given by email.",
"sq", "encrypt", "--for-email", "alice@example.org",
"document.txt",
],
hide: &[],
}),
]
};

View File

@ -5,6 +5,8 @@
//! data structures to describe the examples, mechanisms to format the
//! examples, and infrastructure to execute the examples.
use std::collections::BTreeMap;
use clap::builder::IntoResettable;
use clap::builder::Resettable;
@ -51,6 +53,7 @@ pub struct Example<'a> {
// A human-readable comment.
pub comment: &'a str,
pub command: &'a [ &'a str ],
pub hide: &'a [ &'a str ],
}
/// Builds up example actions in an extensible way.
@ -65,7 +68,8 @@ impl<'a> ExampleBuilder<'a> {
example: Example {
comment: "",
command: &[],
}
hide: &[],
},
}
}
@ -87,6 +91,15 @@ impl<'a> ExampleBuilder<'a> {
self
}
/// Hides the parameters in the output
///
/// Skip these parameters when generating human readable output
#[allow(unused)]
pub const fn hide(mut self, hide: &'a [&'a str]) -> Self {
self.example.hide = hide;
self
}
/// Finishes building the example action.
///
/// The example will be executed by the test.
@ -200,6 +213,7 @@ impl<'a> IntoResettable<clap::builder::StyledStr> for Actions<'a> {
//
// warning: Continuation in example exceeds 57 chars:
let command = wrap_command(&example.command,
&example.hide,
"", width.min(64),
" ", width.min(57));
@ -218,18 +232,35 @@ impl<'a> IntoResettable<clap::builder::StyledStr> for Actions<'a> {
/// any continuations are prefixed with `continuation_indent` and
/// wrapped to `continuation_width`.
pub fn wrap_command<S: AsRef<str>>(command: &[S],
hide: &[S],
indent: &str,
to_width: usize,
continuation_indent: &str,
continuation_width: usize)
-> String
-> String
{
let prompt = platform! {
unix => { "$" },
windows => { ">" },
};
command.iter()
let mut hide
= BTreeMap::from_iter(hide.iter().map(|s| (s.as_ref(), false)));
let result = command
.iter()
.filter(|&item| {
// Remove all of the items in command which are also in
// hide.
if let Some(used) = hide.get_mut(item.as_ref()) {
*used = true;
// Don't show it.
false
} else {
// Show it.
true
}
})
.fold(vec![format!("{}{}", indent, prompt)], |mut s, arg| {
let first = s.len() == 1;
@ -273,7 +304,22 @@ pub fn wrap_command<S: AsRef<str>>(command: &[S],
s
})
.join("\n")
.join("\n");
#[cfg(debug_assertions)]
for (arg, used) in hide.into_iter() {
if ! used {
panic!("Example `{}` includes an argument to hide (`{}`), but the \
argument wasn't used by the example!",
command.iter()
.map(|arg| arg.as_ref().to_string())
.collect::<Vec<String>>()
.join(" "),
arg);
}
}
result
}
macro_rules! test_examples {

View File

@ -19,6 +19,7 @@ Inspect a certificate.",
command: &[
"sq", "inspect", "juliet.pgp",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -26,6 +27,7 @@ Show how the certificate looked on July 21, 2013.",
command: &[
"sq", "inspect", "--time", "20130721", "juliet.pgp",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -33,6 +35,7 @@ Inspect an encrypted message.",
command: &[
"sq", "inspect", "message.pgp",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -40,6 +43,7 @@ Inspect a detached signature.",
command: &[
"sq", "inspect", "document.sig",
],
hide: &[],
}),
]
};

View File

@ -53,6 +53,7 @@ Lists the approved certifications on all the user IDs.",
"sq", "key", "approvals", "list",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
Action::Example(Example {
@ -63,6 +64,7 @@ Lists the unapproved certifications on all the user IDs.",
"--pending",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
Action::Example(Example {
@ -74,6 +76,7 @@ Lists all unapproved certifications on a given user ID.",
"--email=alice@example.org",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
]
};
@ -170,6 +173,7 @@ Approve of all of the certifications on all of Alice's user IDs.",
"--add-all",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
Action::Example(Example {
@ -182,6 +186,7 @@ discarding all prior approvals first.",
"--add-by=511257EBBF077B7AEDAE5D093F68CB84CE537C9A",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
Action::Example(Example {
@ -195,6 +200,7 @@ can be authenticated, discarding all prior approvals first.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--userid=Alice <alice@example.org>",
],
hide: &[],
}),
Action::Example(Example {
@ -205,6 +211,7 @@ Remove the approval of Bob's certification on all of Alice's user IDs.",
"--remove-by=511257EBBF077B7AEDAE5D093F68CB84CE537C9A",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
]
};

View File

@ -43,6 +43,7 @@ Delete any secret key associated with Alice's certificate.",
"sq", "key", "delete",
"--cert", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
Action::Setup(Setup {
@ -67,6 +68,7 @@ selected by user ID.",
"sq", "key", "delete",
"--cert-email=alice@example.org",
],
hide: &[],
}),
]
};

View File

@ -23,6 +23,7 @@ const EXAMPLES: Actions = Actions {
"sq", "key", "expire", "--expiration", "1y",
"--cert", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
Action::Example(Example {
@ -31,6 +32,7 @@ const EXAMPLES: Actions = Actions {
"sq", "key", "expire", "--expiration", "never",
"--cert", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
],
};

View File

@ -66,6 +66,7 @@ Export Alice's certificate with all available secret key material.",
"sq", "key", "export",
"--cert", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
Action::Example(Example {
@ -76,6 +77,7 @@ identified by email address.",
"sq", "key", "export",
"--cert-email", "alice@example.org",
],
hide: &[],
}),
]
};

View File

@ -268,6 +268,7 @@ Generate a key, and save it on the key store.",
"--name", "Alice",
"--email", "alice@example.org",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -280,6 +281,7 @@ Generate a key, and save it in a file instead of in the key store.",
"--output", "alice-priv.pgp",
"--rev-cert", "alice-priv.rev",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -289,6 +291,7 @@ Strip the secret key material from the new key.",
"--cert-file=alice-priv.pgp",
"--output=alice.pgp",
],
hide: &[],
}),
]
};

View File

@ -27,6 +27,7 @@ Import the keys into the key store.",
command: &[
"sq", "key", "import", "alice-secret.pgp",
],
hide: &[],
}),
]
};

View File

@ -54,6 +54,7 @@ List the keys managed by the keystore server.",
command: &[
"sq", "key", "list",
],
hide: &[],
}),
Action::Example(Example {
@ -64,6 +65,7 @@ with a user ID in example.org.",
"sq", "key", "list",
"--cert-domain=example.org",
],
hide: &[],
}),
]
};

View File

@ -77,6 +77,7 @@ specified file.",
"--new-password-file", "password-file.txt",
"--cert", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0"
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -87,6 +88,7 @@ Clear the password protection for all of Alice's keys.",
"--clear-password",
"--cert", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0"
],
hide: &[],
}),
]
};

View File

@ -25,6 +25,7 @@ Revoke Alice's key, indicating that there is a new certificate.",
"--reason", "superseded",
"--message", "My new cert is C5999E8191BF7B503653BE958B1F7910D01F86E5",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -36,6 +37,7 @@ compromised.",
"--reason", "compromised",
"--message", "Computer attacked, secret key material compromised",
],
hide: &[],
}),
]
};

View File

@ -181,6 +181,7 @@ Add a new signing-capable subkey to Alice's key.",
"--can-sign",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
]
};

View File

@ -171,6 +171,7 @@ Bind Alice's old authentication subkey to Alice's new certificate.",
"--cert=C5999E8191BF7B503653BE958B1F7910D01F86E5",
"--key=0D45C6A756A038670FDFD85CB1C82E8D27DB23A1",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -184,6 +185,7 @@ keys, e.g., keys generated on an OpenPGP card, a TPM device, etc.",
"--key=B321BA8F650CB16443E06826DBFA98A78CF6562F",
"--can-encrypt=universal",
],
hide: &[],
}),
]
};

View File

@ -102,6 +102,7 @@ Delete Alice's signing subkey.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--key=42020B87D51877E5AF8D272124F3955B0B8DECC8",
],
hide: &[],
}),
]
};

View File

@ -98,6 +98,7 @@ Change Alice's authentication subkey to expire in 6 months.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--key=0D45C6A756A038670FDFD85CB1C82E8D27DB23A1",
],
hide: &[],
}),
],
};

View File

@ -80,6 +80,7 @@ her primary key or her authentication-capable subkey.",
"--key=42020B87D51877E5AF8D272124F3955B0B8DECC8",
"--key=74DCDEAF17D9B995679EB52BA6E65EA2C8497728",
],
hide: &[],
}),
]
};

View File

@ -123,6 +123,7 @@ specified file.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--key=42020B87D51877E5AF8D272124F3955B0B8DECC8",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -134,6 +135,7 @@ Clear the password protection for Alice's signing key.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--key=42020B87D51877E5AF8D272124F3955B0B8DECC8",
],
hide: &[],
}),
]
};

View File

@ -185,6 +185,7 @@ Revoke Alice's signing subkey.",
"--reason", "retired",
"--message", "Subkey rotation.",
],
hide: &[],
}),
Action::Example(Example {
@ -198,6 +199,7 @@ Revoke Alice's signing subkey and encryption subkeys.",
"--reason", "retired",
"--message", "Subkey rotation.",
],
hide: &[],
}),
],
};

View File

@ -51,6 +51,7 @@ Add a new user ID to Alice's key.",
"--name", "Alice",
"--email", "alice@work.example.com",
],
hide: &[],
}),
]
};
@ -178,6 +179,7 @@ Retire a user ID on Alice's key.",
"--reason", "retired",
"--message", "No longer at example.org.",
],
hide: &[],
}),
]
};

View File

@ -192,6 +192,7 @@ Convert all keys to certificates (i.e. remove any secret key material).",
"--to-cert",
"certs.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -203,6 +204,7 @@ Get all certificates with a user ID on example.org.",
"--domain=example.org",
"certs.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -215,6 +217,7 @@ Get all certificates with a user ID on example.org or example.net.",
"--domain=example.net",
"certs.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -226,6 +229,7 @@ Get all certificates with a name user ID matching Romeo.",
"--name=Romeo",
"certs.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -240,6 +244,7 @@ Get all certificates with a name user ID matching Romeo on example.org.",
"--experimental",
"--name=Romeo",
],
hide: &[],
}),
Action::Example(Example {
@ -252,6 +257,7 @@ Get all certificates with a user ID on example.org, pruning other user IDs.",
"--prune-certs",
"certs.pgp",
],
hide: &[],
}),
],
};
@ -298,6 +304,7 @@ const MERGE_EXAMPLES: Actions = Actions {
"sq", "keyring", "merge",
"bob.pgp", "bob-updates.pgp",
],
hide: &[],
}),
],
};
@ -347,6 +354,7 @@ const LIST_EXAMPLES: Actions = Actions {
"sq", "keyring", "list",
"certs.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -359,6 +367,7 @@ List all certificates with a user ID on example.org.",
"certs.pgp",
"|", "sq", "keyring", "list",
],
hide: &[],
}),
],
};
@ -409,6 +418,7 @@ const SPLIT_EXAMPLES: Actions = Actions {
"sq", "keyring", "split",
"certs.pgp",
],
hide: &[],
}),
@ -420,6 +430,7 @@ Split all certificates, merging them first to avoid duplicates.",
"certs.pgp",
"|", "sq", "keyring", "split",
],
hide: &[],
}),
],
};

View File

@ -65,6 +65,7 @@ Generate DANE records from juliet.pgp for example.org.",
"--domain=example.org",
"--cert-file=juliet.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -76,6 +77,7 @@ user ID in example.org.",
"--domain=example.org",
"--all",
],
hide: &[],
}),
],
};

View File

@ -93,6 +93,7 @@ Search for the Qubes master signing certificate.",
command: &[
"sq", "network", "search", "427F11FD0FAA4B080123F01CDDFA1A3E36879494",
],
hide: &[],
}),
Action::SyntaxCheck(Example {
comment: "\
@ -100,6 +101,7 @@ Search for certificates that have are associated with an email address.",
command: &[
"sq", "network", "search", "alice@example.org",
],
hide: &[],
})
]
};

View File

@ -124,6 +124,7 @@ const PUBLISH_EXAMPLES: Actions = Actions {
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--domain=example.org", "public_html",
],
hide: &[],
}),
Action::Example(Example {
@ -134,6 +135,7 @@ const PUBLISH_EXAMPLES: Actions = Actions {
"--cert=511257EBBF077B7AEDAE5D093F68CB84CE537C9A",
"--domain=example.org", "public_html",
],
hide: &[],
}),
Action::Example(Example {
@ -146,6 +148,7 @@ in example.org to the existing WKD hierarchy.",
"--all",
"public_html",
],
hide: &[],
}),
Action::Example(Example {
@ -156,6 +159,7 @@ in example.org to the existing WKD hierarchy.",
"sq", "network", "wkd", "publish",
"--domain=example.org", "public_html",
],
hide: &[],
}),
],
};

View File

@ -123,6 +123,7 @@ Print the packets of a certificate.",
"sq", "packet", "dump",
"juliet.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -132,6 +133,7 @@ Print the packets including cryptographic artifacts of a certificate.",
"sq", "packet", "dump",
"--mpis", "juliet.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -141,6 +143,7 @@ Print the packets including a dump of every byte of a certificate.",
"sq", "packet", "dump",
"--hex", "juliet.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -152,6 +155,7 @@ secret key file.",
"--recipient-file", "bob-secret.pgp",
"message.pgp",
],
hide: &[],
}),
],
};
@ -236,6 +240,7 @@ Unwrap the encryption revealing the signed message.",
"--recipient-file", "bob-secret.pgp",
"message.pgp",
],
hide: &[],
}),
],
};
@ -310,6 +315,7 @@ Split a certificate into individual packets printed to stdout.",
"--output=-",
"juliet.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -321,6 +327,7 @@ individual files with the prefix 'packet'.",
"--output-prefix", "packet",
"document.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -334,6 +341,7 @@ signed message with a prefix signature.",
"packet-2-Signature-Packet",
"packet-1-Literal-Data-Packet",
],
hide: &[],
}),
],
};
@ -389,6 +397,7 @@ individual files with the prefix 'packet'.",
"--output-prefix", "packet",
"document.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -402,6 +411,7 @@ signed message with a prefix signature.",
"packet-2-Signature-Packet",
"packet-1-Literal-Data-Packet",
],
hide: &[],
}),
],
};

View File

@ -65,6 +65,7 @@ Convert a binary OpenPGP message to an ASCII armored OpenPGP message.",
"sq", "packet", "armor",
"message.bin",
],
hide: &[],
}),
Action::Example(Example {
@ -76,6 +77,7 @@ explicitly choosing the armor label.",
"--label=message",
"message.bin",
],
hide: &[],
}),
],
};

View File

@ -48,6 +48,7 @@ Convert an ASCII armored OpenPGP message to a binary OpenPGP message.",
"--output=message.bin",
"message.pgp",
],
hide: &[],
}),
],
};

View File

@ -83,7 +83,8 @@ Authenticate a specific binding.",
"sq", "pki", "authenticate",
"--cert", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--userid", "Alice <alice@example.org>",
]
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -94,6 +95,7 @@ address for the given certificate.",
"--cert", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--email", "alice@example.org",
],
hide: &[],
}),
]
};

View File

@ -73,6 +73,7 @@ Identify the user IDs that can be authenticated for the certificate.",
"sq", "pki", "identify",
"--cert", "EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -81,6 +82,7 @@ List all user IDs that have that have been certified by anyone.",
"sq", "pki", "identify", "--gossip",
"--cert", "511257EBBF077B7AEDAE5D093F68CB84CE537C9A",
],
hide: &[],
}),
]
};

View File

@ -73,6 +73,7 @@ with the email address alice@example.org.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--email=alice@example.org",
],
hide: &[],
}),
Action::Example(Example {
@ -86,6 +87,7 @@ user IDs for a week.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--all",
],
hide: &[],
}),
Action::Example(Example {
@ -100,6 +102,7 @@ certificate is considered a trusted introducer for example.org.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--all",
],
hide: &[],
}),
Action::Example(Example {
@ -107,6 +110,7 @@ certificate is considered a trusted introducer for example.org.",
command: &[
"sq", "pki", "link", "list",
],
hide: &[],
}),
Action::Example(Example {
@ -118,6 +122,7 @@ and any associated user IDs. This effectively invalidates all links.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--all",
],
hide: &[],
}),
],
};
@ -244,6 +249,7 @@ with the email address alice@example.org.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--email=alice@example.org",
],
hide: &[],
}),
Action::Example(Example {
@ -253,6 +259,7 @@ First, examine the certificate EB28F26E2739A4870ECC47726F0073F60FD0CBF0.",
"sq", "inspect",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
],
hide: &[],
}),
Action::Example(Example {
@ -266,6 +273,7 @@ user IDs for a week.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--all",
],
hide: &[],
}),
Action::Example(Example {
@ -278,6 +286,7 @@ user IDs.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--all",
],
hide: &[],
}),
],
};
@ -454,6 +463,7 @@ Add an unconstrained trusted introducer.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--all",
],
hide: &[],
}),
Action::Example(Example {
@ -466,6 +476,7 @@ Add a trusted introducer for example.org and example.com.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--all",
],
hide: &[],
}),
Action::Example(Example {
@ -478,6 +489,7 @@ Add a partially trusted introducer.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--all",
],
hide: &[],
}),
],
};
@ -554,6 +566,7 @@ with the email address alice@example.org.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--email=alice@example.org",
],
hide: &[],
}),
Action::Example(Example {
@ -565,6 +578,7 @@ and the email address alice@example.org.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--email=alice@example.org",
],
hide: &[],
}),
Action::Example(Example {
@ -576,6 +590,7 @@ and any associated user IDs. This effectively invalidates all links.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--all",
],
hide: &[],
}),
],
};
@ -632,6 +647,7 @@ with the email address alice@example.org.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--email=alice@example.org",
],
hide: &[],
}),
Action::Example(Example {
@ -639,6 +655,7 @@ with the email address alice@example.org.",
command: &[
"sq", "pki", "link", "list",
],
hide: &[],
}),
Action::Example(Example {
@ -647,6 +664,7 @@ with the email address alice@example.org.",
"sq", "pki", "link", "list",
"--cert-domain=example.org",
],
hide: &[],
}),
],
};

View File

@ -69,6 +69,7 @@ Lookup certificates that can be authenticated for the given user ID.",
"sq", "pki", "lookup",
"--userid", "Alice <alice@example.org>"
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -78,6 +79,7 @@ address, and that user ID can be authenticated.",
"sq", "pki", "lookup",
"--email", "alice@example.org",
],
hide: &[],
}),
]
};

View File

@ -70,6 +70,7 @@ Verify that Alice ceritified a particular User ID for Bob's certificate.",
"511257EBBF077B7AEDAE5D093F68CB84CE537C9A",
"--userid", "Bob <bob@example.org>",
],
hide: &[],
})
],
};

View File

@ -79,6 +79,7 @@ Certify EB28F26E2739A4870ECC47726F0073F60FD0CBF0 for alice@example.org.",
"--cert=EB28F26E2739A4870ECC47726F0073F60FD0CBF0",
"--email=alice@example.org",
],
hide: &[],
}),
Action::Example(Example {
@ -92,6 +93,7 @@ for example.org.",
"--domain=example.org",
"--all",
],
hide: &[],
}),
],
};

View File

@ -33,6 +33,7 @@ Alice certifies that Bob controls 3F68CB84CE537C9A and bob@example.org.",
"--cert=511257EBBF077B7AEDAE5D093F68CB84CE537C9A",
"--email=bob@example.org",
],
hide: &[],
}),
Action::Example(Example {
@ -45,6 +46,7 @@ which is not a self-signed user ID.",
"--cert=511257EBBF077B7AEDAE5D093F68CB84CE537C9A",
"--email-or-add=bob@bobs.lair.net",
],
hide: &[],
}),
],
};

View File

@ -43,6 +43,7 @@ for example.org and example.com.",
"--domain=example.com",
"--all",
],
hide: &[],
}),
],
};

View File

@ -29,6 +29,7 @@ Create a signed message.",
"--message",
"document.txt",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -37,6 +38,7 @@ Create a detached signature.",
"sq", "sign", "--signer-file", "juliet-secret.pgp",
"--signature-file", "document.txt",
],
hide: &[],
}),
Action::Example(Example {
comment: "\
@ -46,6 +48,7 @@ Create a signature with the specified creation time.",
"--time", "2024-02-29",
"--signature-file", "document.txt",
],
hide: &[],
}),
]
};

View File

@ -33,6 +33,7 @@ Verify a signed message.",
command: &[
"sq", "verify", "--message", "document.pgp",
],
hide: &[],
}),
Action::Example(Example {
@ -41,6 +42,7 @@ Verify a detached signature.",
command: &[
"sq", "verify", "--signature-file=document.sig", "document.txt",
],
hide: &[],
}),
Action::Example(Example {
@ -50,6 +52,7 @@ Verify a message as of June 19, 2024 at midnight UTC.",
"sq", "verify", "--time", "2024-06-19",
"--message", "document.pgp",
],
hide: &[],
}),
]
};

View File

@ -97,7 +97,7 @@ impl Command {
eprintln!();
eprintln!("{}", crate::cli::examples::wrap_command(
&self.args, " ", width, " ", width));
&self.args, &[], " ", width, " ", width));
}
if cfg!(debug_assertions) && self.args[0] == "sq" {