Refactor packet and keyring files in /cli to new example framework.
- No content changes.
This commit is contained in:
parent
aba6fb6104
commit
f1c30786d7
@ -190,67 +190,52 @@ a certificate.",
|
||||
|
||||
const FILTER_EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Setup(Setup {
|
||||
command: &[
|
||||
Action::setup().command(&[
|
||||
"sq", "keyring", "merge",
|
||||
"--output=certs.pgp",
|
||||
"bob.pgp", "romeo.pgp",
|
||||
],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Convert all keys to certificates (i.e. remove any secret key material).",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Convert all keys to certificates (i.e. remove any secret key material).",
|
||||
).command(&[
|
||||
"sq", "keyring", "filter",
|
||||
"--experimental",
|
||||
"--to-cert",
|
||||
"certs.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Get all certificates with a user ID on example.org.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Get all certificates with a user ID on example.org.",
|
||||
).command(&[
|
||||
"sq", "keyring", "filter",
|
||||
"--experimental",
|
||||
"--domain=example.org",
|
||||
"certs.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Get all certificates with a user ID on example.org or example.net.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Get all certificates with a user ID on example.org or example.net.",
|
||||
).command(&[
|
||||
"sq", "keyring", "filter",
|
||||
"--experimental",
|
||||
"--domain=example.org",
|
||||
"--domain=example.net",
|
||||
"certs.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Get all certificates with a name user ID matching Romeo.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Get all certificates with a name user ID matching Romeo.",
|
||||
).command(&[
|
||||
"sq", "keyring", "filter",
|
||||
"--experimental",
|
||||
"--name=Romeo",
|
||||
"certs.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Get all certificates with a name user ID matching Romeo on example.org.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Get all certificates with a name user ID matching Romeo on example.org.",
|
||||
).command(&[
|
||||
"sq", "keyring", "filter",
|
||||
"--experimental",
|
||||
"--domain=example.org",
|
||||
@ -258,22 +243,17 @@ Get all certificates with a name user ID matching Romeo on example.org.",
|
||||
"|", "sq", "keyring", "filter",
|
||||
"--experimental",
|
||||
"--name=Romeo",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Get all certificates with a user ID on example.org, pruning other user IDs.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Get all certificates with a user ID on example.org, pruning other user IDs.",
|
||||
).command(&[
|
||||
"sq", "keyring", "filter",
|
||||
"--experimental",
|
||||
"--domain=example.org",
|
||||
"--prune-certs",
|
||||
"certs.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_keyring_filter, FILTER_EXAMPLES);
|
||||
@ -305,22 +285,18 @@ pub struct MergeCommand {
|
||||
|
||||
const MERGE_EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Setup(Setup {
|
||||
command: &[
|
||||
Action::setup().command(&[
|
||||
"sq", "packet", "dearmor",
|
||||
"--output=bob-updates.pgp",
|
||||
"bob.pgp",
|
||||
],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "Merge certificate updates.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Merge certificate updates.",
|
||||
).command(&[
|
||||
"sq", "keyring", "merge",
|
||||
"bob.pgp", "bob-updates.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_keyring_merge, MERGE_EXAMPLES);
|
||||
@ -357,35 +333,28 @@ standard policy.",
|
||||
|
||||
const LIST_EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Setup(Setup {
|
||||
command: &[
|
||||
Action::setup().command(&[
|
||||
"sq", "keyring", "merge",
|
||||
"--output=certs.pgp",
|
||||
"bob.pgp", "romeo.pgp",
|
||||
],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "List all certificates.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"List all certificates.",
|
||||
).command(&[
|
||||
"sq", "keyring", "list",
|
||||
"certs.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
List all certificates with a user ID on example.org.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"List all certificates with a user ID on example.org.",
|
||||
).command(&[
|
||||
"sq", "keyring", "filter",
|
||||
"--experimental",
|
||||
"--domain=example.org",
|
||||
"certs.pgp",
|
||||
"|", "sq", "keyring", "list",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_keyring_list, LIST_EXAMPLES);
|
||||
@ -421,34 +390,26 @@ pub struct SplitCommand {
|
||||
|
||||
const SPLIT_EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Setup(Setup {
|
||||
command: &[
|
||||
Action::setup().command(&[
|
||||
"sq", "keyring", "merge",
|
||||
"--output=certs.pgp",
|
||||
"bob.pgp", "romeo.pgp",
|
||||
],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "Split all certificates.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Split all certificates.",
|
||||
).command(&[
|
||||
"sq", "keyring", "split",
|
||||
"certs.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Split all certificates, merging them first to avoid duplicates.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Split all certificates, merging them first to avoid duplicates.",
|
||||
).command(&[
|
||||
"sq", "keyring", "merge",
|
||||
"certs.pgp",
|
||||
"|", "sq", "keyring", "split",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_keyring_split, SPLIT_EXAMPLES);
|
||||
|
@ -116,47 +116,35 @@ pub struct DumpCommand {
|
||||
|
||||
const DUMP_EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Print the packets of a certificate.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Print the packets of a certificate.",
|
||||
).command(&[
|
||||
"sq", "packet", "dump",
|
||||
"juliet.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Print the packets including cryptographic artifacts of a certificate.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Print the packets including cryptographic artifacts of a certificate.",
|
||||
).command(&[
|
||||
"sq", "packet", "dump",
|
||||
"--mpis", "juliet.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Print the packets including a dump of every byte of a certificate.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Print the packets including a dump of every byte of a certificate.",
|
||||
).command(&[
|
||||
"sq", "packet", "dump",
|
||||
"--hex", "juliet.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Prints the packets of an encrypted message, decrypting it using a \
|
||||
Action::example().comment(
|
||||
"Prints the packets of an encrypted message, decrypting it using a \
|
||||
secret key file.",
|
||||
command: &[
|
||||
).command(&[
|
||||
"sq", "packet", "dump",
|
||||
"--recipient-file", "bob-secret.pgp",
|
||||
"message.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_packet_dump, DUMP_EXAMPLES);
|
||||
@ -232,16 +220,13 @@ pub struct DecryptCommand {
|
||||
|
||||
const DECRYPT_EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Unwrap the encryption revealing the signed message.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Unwrap the encryption revealing the signed message.",
|
||||
).command(&[
|
||||
"sq", "packet", "decrypt",
|
||||
"--recipient-file", "bob-secret.pgp",
|
||||
"message.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_packet_decrypt, DECRYPT_EXAMPLES);
|
||||
@ -307,42 +292,33 @@ a human-readable packet type with dashes ('-').
|
||||
|
||||
const SPLIT_EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Split a certificate into individual packets printed to stdout.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Split a certificate into individual packets printed to stdout.",
|
||||
).command(&[
|
||||
"sq", "packet", "split",
|
||||
"--output=-",
|
||||
"juliet.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Split a inline-signed message into individual packets written to \
|
||||
Action::example().comment(
|
||||
"Split a inline-signed message into individual packets written to \
|
||||
individual files with the prefix 'packet'.",
|
||||
command: &[
|
||||
).command(&[
|
||||
"sq", "packet", "split",
|
||||
"--output-prefix", "packet",
|
||||
"document.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Then reassemble the message, transforming it into an old-style \
|
||||
Action::example().comment(
|
||||
"Then reassemble the message, transforming it into an old-style \
|
||||
signed message with a prefix signature.",
|
||||
command: &[
|
||||
).command(&[
|
||||
"sq", "packet", "join",
|
||||
"--output", "prefix-signature.pgp",
|
||||
"--label", "message",
|
||||
"packet-2-Signature-Packet",
|
||||
"packet-1-Literal-Data-Packet",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_packet_split, SPLIT_EXAMPLES);
|
||||
@ -388,31 +364,25 @@ pub struct JoinCommand {
|
||||
|
||||
const JOIN_EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Split a inline-signed message into individual packets written to \
|
||||
Action::example().comment(
|
||||
"Split a inline-signed message into individual packets written to \
|
||||
individual files with the prefix 'packet'.",
|
||||
command: &[
|
||||
).command(&[
|
||||
"sq", "packet", "split",
|
||||
"--output-prefix", "packet",
|
||||
"document.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Then reassemble the message, transforming it into an old-style \
|
||||
Action::example().comment(
|
||||
"Then reassemble the message, transforming it into an old-style \
|
||||
signed message with a prefix signature.",
|
||||
command: &[
|
||||
).command(&[
|
||||
"sq", "packet", "join",
|
||||
"--output", "prefix-signature.pgp",
|
||||
"--label", "message",
|
||||
"packet-2-Signature-Packet",
|
||||
"packet-1-Literal-Data-Packet",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_packet_join, JOIN_EXAMPLES);
|
||||
|
@ -50,35 +50,27 @@ pub struct Command {
|
||||
|
||||
const EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Setup(Setup {
|
||||
command: &[
|
||||
Action::setup().command(&[
|
||||
"sq", "packet", "dearmor",
|
||||
"--output=message.bin",
|
||||
"message.pgp",
|
||||
],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Convert a binary OpenPGP message to an ASCII armored OpenPGP message.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Convert a binary OpenPGP message to an ASCII armored OpenPGP message.",
|
||||
).command(&[
|
||||
"sq", "packet", "armor",
|
||||
"message.bin",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Convert a binary OpenPGP message to an ASCII armored OpenPGP message
|
||||
Action::example().comment(
|
||||
"Convert a binary OpenPGP message to an ASCII armored OpenPGP message
|
||||
explicitly choosing the armor label.",
|
||||
command: &[
|
||||
).command(&[
|
||||
"sq", "packet", "armor",
|
||||
"--label=message",
|
||||
"message.bin",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_packet_armor, EXAMPLES);
|
||||
|
@ -40,16 +40,13 @@ pub struct Command {
|
||||
|
||||
const EXAMPLES: Actions = Actions {
|
||||
actions: &[
|
||||
Action::Example(Example {
|
||||
comment: "\
|
||||
Convert an ASCII armored OpenPGP message to a binary OpenPGP message.",
|
||||
command: &[
|
||||
Action::example().comment(
|
||||
"Convert an ASCII armored OpenPGP message to a binary OpenPGP message.",
|
||||
).command(&[
|
||||
"sq", "packet", "dearmor",
|
||||
"--output=message.bin",
|
||||
"message.pgp",
|
||||
],
|
||||
hide: &[],
|
||||
}),
|
||||
]).build(),
|
||||
],
|
||||
};
|
||||
test_examples!(sq_packet_dearmor, EXAMPLES);
|
||||
|
Loading…
x
Reference in New Issue
Block a user