Compare commits

..

2 Commits

Author SHA1 Message Date
Bel LaPointe
b2df61a235 break 2023-11-27 16:00:09 -07:00
Bel LaPointe
38e6e19d7b tests pass 2023-11-27 10:14:55 -07:00

View File

@@ -4,6 +4,7 @@ use std::fs::File;
use std::time::{SystemTime, UNIX_EPOCH, Duration}; use std::time::{SystemTime, UNIX_EPOCH, Duration};
use std::ops::{Add, Sub}; use std::ops::{Add, Sub};
use clap::Parser; use clap::Parser;
use std::collections::HashMap;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
struct Flags { struct Flags {
@@ -47,11 +48,27 @@ fn add(f: &String, x: &Option<String>, tag: &Option<String>) -> Result<(), Strin
Ok(()) 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> { fn log(f: &String, since: &Option<String>) -> Result<(), String> {
let since = parse_time(since)?; let since = parse_time(since)?;
let tsheet = load(&f)?; let tsheet = load(&f)?;
let tsheet = tsheet.since(since); let tsheet = tsheet.since(since);
println!("{:?}", tsheet); let mut logs = HashMap::new();
for &x in &tsheet.xs {
}
println!("{:?}", logs);
Err("not impl".to_string()) Err("not impl".to_string())
} }
@@ -126,7 +143,7 @@ mod test_save_load {
X{t: 2, x: "ghi".to_string(), tag: "".to_string()}, X{t: 2, x: "ghi".to_string(), tag: "".to_string()},
]}; ]};
assert_eq!( 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, want,
); );