diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2022-07-02 15:50:29 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2022-07-05 13:57:05 +0200 |
commit | 993d61efd20490f6d1c503e27f1f788bc296c43c (patch) | |
tree | 89c9d75814a4ef5e768a1cefdaedaf43470fa6c8 | |
parent | cd724f9bee486d77d978e59eb9c35d6614f79ea9 (diff) |
sq: Adapt sq packet split to clap3's derive API.
-rw-r--r-- | sq/src/sq.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sq/src/sq.rs b/sq/src/sq.rs index 071a1150..327d3b5b 100644 --- a/sq/src/sq.rs +++ b/sq/src/sq.rs @@ -695,13 +695,15 @@ fn main() -> Result<()> { }, Some(("split", m)) => { - let mut input = open_or_stdin(m.value_of("input"))?; + use clap::FromArgMatches; + let command = sq_cli::PacketSplitCommand::from_arg_matches(m)?; + + let mut input = open_or_stdin(command.input.as_deref())?; let prefix = // The prefix is either specified explicitly... - m.value_of("prefix").map(|p| p.to_owned()) - .unwrap_or( + command.prefix.unwrap_or( // ... or we derive it from the input file... - m.value_of("input").and_then(|i| { + command.input.and_then(|i| { let p = PathBuf::from(i); // (but only use the filename) p.file_name().map(|f| String::from(f.to_string_lossy())) |