Implement add_command() with backend
This commit is contained in:
parent
c9ebe3b7a1
commit
e78bde72c1
1 changed files with 6 additions and 4 deletions
|
@ -7,7 +7,8 @@ use module::CommandEnv;
|
||||||
|
|
||||||
use module::bm::header::build_header;
|
use module::bm::header::build_header;
|
||||||
use storage::json::parser::JsonHeaderParser;
|
use storage::json::parser::JsonHeaderParser;
|
||||||
use storage::parser::FileHeaderParser;
|
use storage::parser::{Parser, FileHeaderParser};
|
||||||
|
use storage::file::File;
|
||||||
|
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
@ -18,8 +19,9 @@ pub fn add_command(module: &Module, env: CommandEnv) -> CommandResult {
|
||||||
info!("Adding url '{}' with tags '{:?}'", url, tags);
|
info!("Adding url '{}' with tags '{:?}'", url, tags);
|
||||||
|
|
||||||
let header = build_header(&String::from(url), &tags);
|
let header = build_header(&String::from(url), &tags);
|
||||||
let jheader = JsonHeaderParser::new(None).write(&header);
|
let file = File::new_with_header(module, header);
|
||||||
println!("JSON: {:?}", jheader);
|
let parser = Parser::new(JsonHeaderParser::new(None));
|
||||||
|
let putres = env.bk.put_file(file, &parser);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue