Compare commits
2 Commits
631b4cab32
...
b2df61a235
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2df61a235 | ||
|
|
38e6e19d7b |
21
src/main.rs
21
src/main.rs
@@ -4,6 +4,7 @@ use std::fs::File;
|
||||
use std::time::{SystemTime, UNIX_EPOCH, Duration};
|
||||
use std::ops::{Add, Sub};
|
||||
use clap::Parser;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
struct Flags {
|
||||
@@ -47,11 +48,27 @@ fn add(f: &String, x: &Option<String>, tag: &Option<String>) -> Result<(), Strin
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
struct Log {
|
||||
t: String,
|
||||
d: u8,
|
||||
xs: Vec<LogX>,
|
||||
}
|
||||
#[derive(Debug, Serialize)]
|
||||
struct LogX {
|
||||
d: u8,
|
||||
x: String,
|
||||
xs: Vec<String>,
|
||||
}
|
||||
|
||||
fn log(f: &String, since: &Option<String>) -> Result<(), String> {
|
||||
let since = parse_time(since)?;
|
||||
let tsheet = load(&f)?;
|
||||
let tsheet = tsheet.since(since);
|
||||
println!("{:?}", tsheet);
|
||||
let mut logs = HashMap::new();
|
||||
for &x in &tsheet.xs {
|
||||
}
|
||||
println!("{:?}", logs);
|
||||
Err("not impl".to_string())
|
||||
}
|
||||
|
||||
@@ -126,7 +143,7 @@ mod test_save_load {
|
||||
X{t: 2, x: "ghi".to_string(), tag: "".to_string()},
|
||||
]};
|
||||
assert_eq!(
|
||||
load("./src/testdata/standalone.yaml".to_string()).expect("cant load standalone.yaml"),
|
||||
load(&"./src/testdata/standalone.yaml".to_string()).expect("cant load standalone.yaml"),
|
||||
want,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user