Debian Codegraph @

src/cli/packet/dearmor.rs

raw
1 use clap::Parser;
2
3 use crate::cli::examples::*;
4 use crate::cli::types::ClapData;
5 use crate::cli::types::FileOrStdin;
6 use crate::cli::types::FileOrStdout;
7
8 #[derive(Parser, Debug)]
9 #[clap(
10 name = "dearmor",
11 about = "Convert ASCII to binary",
12 long_about =
13 "Convert ASCII to binary
14
15 To make encrypted data easier to handle and transport, OpenPGP data \
16 can be transformed to an ASCII representation called ASCII Armor. sq \
17 transparently handles armored data, but this subcommand can be used to \
18 explicitly convert existing ASCII-encoded OpenPGP data to its binary \
19 representation.
20
21 The converse operation is `sq packet armor`.
22 ",
23 after_help = EXAMPLES,
24 )]
25 pub struct Command {
26 #[clap(
27 default_value_t = FileOrStdin::default(),
28 help = FileOrStdin::HELP_OPTIONAL,
29 value_name = FileOrStdin::VALUE_NAME,
30 )]
31 pub input: FileOrStdin,
32 #[clap(
33 default_value_t = FileOrStdout::default(),
34 help = FileOrStdout::HELP_OPTIONAL,
35 long,
36 value_name = FileOrStdout::VALUE_NAME,
37 )]
38 pub output: FileOrStdout,
39 }
40
41 const EXAMPLES: Actions = Actions {
42 actions: &[
43 Action::example().comment(
44 "Convert an ASCII armored OpenPGP message to a binary OpenPGP message.",
45 ).command(&[
46 "sq", "packet", "dearmor",
47 "--output=message.bin",
48 "message.pgp",
49 ]).build(),
50 ],
51 };
52 test_examples!(sq_packet_dearmor, EXAMPLES);