mirror of
https://gitlab.com/keys.openpgp.org/hagrid.git
synced 2025-10-06 00:23:08 +02:00
Extract cmd dispatch code from src/delete/main.rs to delete::cli module.
Changes: - Introduce cli::dispatch_cmd() function which just delegate to delete function.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
use structopt::StructOpt;
|
||||
use std::path::PathBuf;
|
||||
use hagrid_database::KeyDatabase;
|
||||
use crate::delete;
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[structopt(
|
||||
@@ -23,3 +25,7 @@ pub(crate) struct Opt {
|
||||
#[structopt(long = "all")]
|
||||
pub(crate) all: bool,
|
||||
}
|
||||
|
||||
pub(crate) fn dispatch_cmd(opts: &Opt, db: &KeyDatabase) -> anyhow::Result<()> {
|
||||
delete(&db, &opts.query.parse()?, opts.all_bindings, opts.all)
|
||||
}
|
@@ -20,9 +20,10 @@ fn main() {
|
||||
}
|
||||
|
||||
fn real_main() -> anyhow::Result<()> {
|
||||
let opt = cli::Opt::from_args();
|
||||
let db = KeyDatabase::new_file(opt.base.canonicalize()?)?;
|
||||
delete(&db, &opt.query.parse()?, opt.all_bindings, opt.all)
|
||||
let opt = &cli::Opt::from_args();
|
||||
let db = &KeyDatabase::new_file(opt.base.canonicalize()?)?;
|
||||
|
||||
cli::dispatch_cmd(opt, db)
|
||||
}
|
||||
|
||||
fn delete(
|
||||
|
Reference in New Issue
Block a user