Move the sq key subkey export implementation to its own module.

This commit is contained in:
Neal H. Walfield 2024-11-05 15:11:44 +01:00
parent 3824be8bbf
commit c665065821
No known key found for this signature in database
GPG Key ID: 6863C9AD5B4D22D3
2 changed files with 14 additions and 11 deletions

View File

@ -18,12 +18,10 @@ use crate::Sq;
use crate::cli::key::subkey::Command;
use crate::cli::key::subkey::delete::Command as DeleteCommand;
use crate::cli::key::subkey::expire::Command as ExpireCommand;
use crate::cli::key::subkey::export::Command as ExportCommand;
use crate::cli::key::subkey::password::Command as PasswordCommand;
use crate::cli::key::subkey::revoke::Command as RevokeCommand;
use crate::commands::key::bind;
use crate::common::key::expire;
use crate::common::key::export;
use crate::common::key::delete;
use crate::common::key::password;
use crate::common::NULL_POLICY;
@ -32,11 +30,12 @@ use crate::common::get_secret_signer;
use crate::parse_notations;
mod add;
mod export;
pub fn dispatch(sq: Sq, command: Command) -> Result<()> {
match command {
Command::Add(c) => add::dispatch(sq, c)?,
Command::Export(c) => subkey_export(sq, c)?,
Command::Export(c) => export::dispatch(sq, c)?,
Command::Delete(c) => subkey_delete(sq, c)?,
Command::Password(c) => subkey_password(sq, c)?,
Command::Expire(c) => subkey_expire(sq, c)?,
@ -47,14 +46,6 @@ pub fn dispatch(sq: Sq, command: Command) -> Result<()> {
Ok(())
}
fn subkey_export(sq: Sq, command: ExportCommand)
-> Result<()>
{
assert!(! command.key.is_empty());
export(sq, vec![], command.key, command.output, command.binary)
}
fn subkey_delete(sq: Sq, command: DeleteCommand)
-> Result<()>
{

View File

@ -0,0 +1,12 @@
use crate::Result;
use crate::Sq;
use crate::common::key::export;
pub fn dispatch(sq: Sq, command: crate::cli::key::subkey::export::Command)
-> Result<()>
{
assert!(! command.key.is_empty());
export(sq, vec![], command.key, command.output, command.binary)
}