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