Move the deamor subcommand's dispatcher and impl to its own module
This commit is contained in:
parent
ddb3d8ffb1
commit
2f0fc12130
21
src/commands/dearmor.rs
Normal file
21
src/commands/dearmor.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use std::io;
|
||||
|
||||
use sequoia_openpgp as openpgp;
|
||||
use openpgp::armor;
|
||||
|
||||
use crate::Config;
|
||||
use crate::Result;
|
||||
use crate::sq_cli;
|
||||
|
||||
pub fn dispatch(config: Config, command: sq_cli::dearmor::Command)
|
||||
-> Result<()>
|
||||
{
|
||||
tracer!(TRACE, "dearmor::dispatch");
|
||||
|
||||
let mut input = command.input.open()?;
|
||||
let mut output = command.output.create_safe(config.force)?;
|
||||
let mut filter = armor::Reader::from_reader(&mut input, None);
|
||||
io::copy(&mut filter, &mut output)?;
|
||||
|
||||
Ok(())
|
||||
}
|
@ -38,6 +38,7 @@ use crate::sq_cli::encrypt::EncryptionMode;
|
||||
pub mod armor;
|
||||
#[cfg(feature = "autocrypt")]
|
||||
pub mod autocrypt;
|
||||
pub mod dearmor;
|
||||
pub mod decrypt;
|
||||
pub mod encrypt;
|
||||
pub mod sign;
|
||||
|
@ -1060,10 +1060,7 @@ fn main() -> Result<()> {
|
||||
commands::armor::dispatch(config, command)?
|
||||
},
|
||||
SqSubcommands::Dearmor(command) => {
|
||||
let mut input = command.input.open()?;
|
||||
let mut output = command.output.create_safe(config.force)?;
|
||||
let mut filter = armor::Reader::from_reader(&mut input, None);
|
||||
io::copy(&mut filter, &mut output)?;
|
||||
commands::dearmor::dispatch(config, command)?
|
||||
},
|
||||
#[cfg(feature = "autocrypt")]
|
||||
SqSubcommands::Autocrypt(command) => {
|
||||
|
@ -13,7 +13,7 @@ use openpgp::Fingerprint;
|
||||
pub mod armor;
|
||||
pub mod certify;
|
||||
pub mod dane;
|
||||
mod dearmor;
|
||||
pub mod dearmor;
|
||||
pub mod decrypt;
|
||||
pub mod encrypt;
|
||||
pub mod export;
|
||||
|
Loading…
Reference in New Issue
Block a user