| 1 |
//! Dispatches `sq key subkey`. |
| 2 |
|
| 3 |
use clap::ArgMatches; |
| 4 |
|
| 5 |
use crate::Result; |
| 6 |
use crate::Sq; |
| 7 |
use crate::cli::key::subkey::Command; |
| 8 |
|
| 9 |
mod add; |
| 10 |
mod bind; |
| 11 |
mod delete; |
| 12 |
mod expire; |
| 13 |
mod export; |
| 14 |
mod password; |
| 15 |
mod revoke; |
| 16 |
|
| 17 |
pub fn dispatch(sq: Sq, command: Command, matches: &ArgMatches) -> Result<()> { |
| 18 |
let matches = matches.subcommand().unwrap().1; |
| 19 |
match command { |
| 20 |
Command::Add(mut c) => { |
| 21 |
c.cipher_suite_source = matches.value_source("cipher_suite"); |
| 22 |
add::dispatch(sq, c)? |
| 23 |
}, |
| 24 |
Command::Export(c) => export::dispatch(sq, c)?, |
| 25 |
Command::Delete(c) => delete::dispatch(sq, c)?, |
| 26 |
Command::Password(c) => password::dispatch(sq, c)?, |
| 27 |
Command::Expire(c) => expire::dispatch(sq, c)?, |
| 28 |
Command::Revoke(c) => revoke::dispatch(sq, c)?, |
| 29 |
Command::Bind(c) => bind::bind(sq, c)?, |
| 30 |
} |
| 31 |
|
| 32 |
Ok(()) |
| 33 |
} |