Implement add_command() with backend

This commit is contained in:
Matthias Beyer 2015-11-28 12:48:50 +01:00
parent c9ebe3b7a1
commit e78bde72c1

View file

@ -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(())
} }