Remove "dump" subcommand

This commit is contained in:
Matthias Beyer 2018-04-24 22:01:14 +02:00
parent 16747aa257
commit be74afd031
3 changed files with 4 additions and 51 deletions

View file

@ -1,39 +0,0 @@
//
// imag - the personal information management suite for the commandline
// Copyright (C) 2015-2018 Matthias Beyer <mail@beyermatthias.de> and contributors
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; version
// 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
use std::process::exit;
use libimagrt::runtime::Runtime;
use libimagerror::trace::*;
pub fn dump(rt: &mut Runtime) {
rt.store()
.entries()
.map_err_trace_exit_unwrap(1)
.for_each(|elem| {
debug!("Working on {:?}", elem);
rt.store().get(elem).map_err_trace_exit_unwrap(1);
});
if let Err(_) = rt.store_backend_to_stdout().map_err_trace() {
error!("Loading Store IO backend failed");
exit(1);
}
}

View file

@ -54,7 +54,6 @@ use libimagerror::trace::MapErrTrace;
mod create; mod create;
mod delete; mod delete;
mod dump;
mod error; mod error;
mod get; mod get;
mod retrieve; mod retrieve;
@ -67,7 +66,6 @@ use std::ops::Deref;
use create::create; use create::create;
use delete::delete; use delete::delete;
use dump::dump;
use get::get; use get::get;
use retrieve::retrieve; use retrieve::retrieve;
use ui::build_ui; use ui::build_ui;
@ -76,10 +74,10 @@ use verify::verify;
fn main() { fn main() {
let version = make_imag_version!(); let version = make_imag_version!();
let mut rt = generate_runtime_setup("imag-store", let rt = generate_runtime_setup("imag-store",
&version, &version,
"Direct interface to the store. Use with great care!", "Direct interface to the store. Use with great care!",
build_ui); build_ui);
let command = rt.cli().subcommand_name().map(String::from); let command = rt.cli().subcommand_name().map(String::from);
@ -92,7 +90,6 @@ fn main() {
"retrieve" => retrieve(&rt), "retrieve" => retrieve(&rt),
"update" => update(&rt), "update" => update(&rt),
"verify" => verify(&rt), "verify" => verify(&rt),
"dump" => dump(&mut rt),
other => { other => {
debug!("Unknown command"); debug!("Unknown command");
let _ = rt.handle_unknown_subcommand("imag-store", other, rt.cli()) let _ = rt.handle_unknown_subcommand("imag-store", other, rt.cli())

View file

@ -190,9 +190,4 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.about("Verify the store") .about("Verify the store")
.version("0.1") .version("0.1")
) )
.subcommand(SubCommand::with_name("dump")
.about("Dump the complete store to stdout. Currently does only support JSON")
.version("0.1")
)
} }