diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2022-07-05 13:53:41 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2022-07-05 13:57:06 +0200 |
commit | 8b8cf3b788b01e5adee6de2570c27c6c4f104b75 (patch) | |
tree | 6505eb7335055ac8edf93aa2a32ca03475fead76 | |
parent | c7dfc0573702baea8470e36ff9b21ebc6ffb1137 (diff) |
sq: Use common io args for sq armor.
-rw-r--r-- | sq/src/sq.rs | 6 | ||||
-rw-r--r-- | sq/src/sq_cli.rs | 11 |
2 files changed, 5 insertions, 12 deletions
diff --git a/sq/src/sq.rs b/sq/src/sq.rs index 1a668403..aaabbd87 100644 --- a/sq/src/sq.rs +++ b/sq/src/sq.rs @@ -527,7 +527,7 @@ fn main() -> Result<()> { // TODO: Extract body to commands/armor.rs SqSubcommands::Armor(command) => { - let input = open_or_stdin(command.input.as_deref())?; + let input = open_or_stdin(command.io.input.as_deref())?; let mut want_kind: Option<armor::Kind> = command.kind.into(); // Peek at the data. If it looks like it is armored @@ -547,7 +547,7 @@ fn main() -> Result<()> { { // It is already armored and has the correct kind. let mut output = - config.create_or_stdout_safe(command.output.as_deref())?; + config.create_or_stdout_safe(command.io.output.as_deref())?; io::copy(&mut input, &mut output)?; return Ok(()); } @@ -562,7 +562,7 @@ fn main() -> Result<()> { let want_kind = want_kind.expect("given or detected"); let mut output = - config.create_or_stdout_pgp(command.output.as_deref(), + config.create_or_stdout_pgp(command.io.output.as_deref(), false, want_kind)?; if already_armored { diff --git a/sq/src/sq_cli.rs b/sq/src/sq_cli.rs index de0ba03a..076259ba 100644 --- a/sq/src/sq_cli.rs +++ b/sq/src/sq_cli.rs @@ -200,15 +200,8 @@ $ sq armor binary-message.pgp " )] pub struct ArmorCommand { - #[clap(value_name = "FILE", help = "Reads from FILE or stdin if omitted")] - pub input: Option<String>, - #[clap( - short, - long, - value_name = "FILE", - help = "Writes to FILE or stdout if omitted" - )] - pub output: Option<String>, + #[clap(flatten)] + pub io: IoArgs, #[clap( long = "label", value_name = "LABEL", |