Add deps: log, toml
This commit is contained in:
parent
98e0e5aaf5
commit
f50c54b6a4
4 changed files with 5 additions and 56 deletions
|
@ -1,16 +0,0 @@
|
|||
pub mod stdout;
|
||||
|
||||
use libimagstore::store::FileLockEntry;
|
||||
|
||||
pub struct ViewInformation<'a> {
|
||||
pub entry: FileLockEntry<'a>,
|
||||
pub view_header: bool,
|
||||
pub view_content: bool,
|
||||
pub view_copy: bool,
|
||||
pub keep_copy: bool,
|
||||
}
|
||||
|
||||
pub trait Viewer {
|
||||
fn view(&self, vi: ViewInformation);
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
use std::io::{Stdout, stdout};
|
||||
|
||||
use toml::encode_str;
|
||||
|
||||
use viewer::{ViewInformation, Viewer};
|
||||
|
||||
pub struct StdoutViewer {
|
||||
out: Stdout,
|
||||
}
|
||||
|
||||
impl StdoutViewer {
|
||||
|
||||
pub fn new() -> StdoutViewer {
|
||||
StdoutViewer { out: stdout() }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
impl Viewer for StdoutViewer {
|
||||
|
||||
fn view(&self, vi: ViewInformation) {
|
||||
if vi.view_copy {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
if vi.view_header {
|
||||
debug!("Going to display header: {:?}", vi.entry.get_header().header());
|
||||
println!("{}", encode_str(vi.entry.get_header().header()));
|
||||
}
|
||||
|
||||
if vi.view_content {
|
||||
println!("{}", vi.entry.get_content());
|
||||
}
|
||||
|
||||
if vi.view_copy && !vi.keep_copy {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,8 @@ version = "0.2.0"
|
|||
authors = ["Matthias Beyer <mail@beyermatthias.de>"]
|
||||
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
toml = "0.1.25"
|
||||
|
||||
[dependencies.libimagstore]
|
||||
path = "../libimagstore"
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
while_true,
|
||||
)]
|
||||
|
||||
#[macro_use] extern crate log;
|
||||
extern crate toml;
|
||||
|
||||
extern crate libimagstore;
|
||||
#[macro_use] extern crate libimagerror;
|
||||
|
||||
|
|
Loading…
Reference in a new issue