mirror of
https://git.alemi.dev/memo-cli.git
synced 2024-11-22 03:14:48 +01:00
small fixes
This commit is contained in:
parent
0fce795d3a
commit
0feb69e7f4
2 changed files with 9 additions and 6 deletions
|
@ -62,7 +62,7 @@ fn main() {
|
|||
}
|
||||
let txt = body.join(" ");
|
||||
storage.add(txt.as_str(), due_date).unwrap();
|
||||
println!("new memo: '{}'", txt);
|
||||
println!("[+] new memo: {}", txt);
|
||||
}
|
||||
Some(Commands::Done { search, many }) => {
|
||||
let rex = Regex::new(search.as_str());
|
||||
|
@ -97,7 +97,11 @@ fn main() {
|
|||
println!("[-] task #{} deleted", id);
|
||||
}
|
||||
None => {
|
||||
for m in storage.all().unwrap() {
|
||||
let all = storage.all().unwrap();
|
||||
if all.len() < 1 {
|
||||
println!("[ ] nothing to remember");
|
||||
}
|
||||
for m in all {
|
||||
println!("{}", m.human());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,19 +38,18 @@ impl HumanDisplay for Memo {
|
|||
if self.due.is_some() {
|
||||
let delta = self.due.unwrap() - Utc::now();
|
||||
if delta.le(&Duration::seconds(0)) {
|
||||
return format!("[*] {} (+{})", self.body, delta.human());
|
||||
return format!("[x] {} (+{})", self.body, delta.human());
|
||||
} else {
|
||||
return format!(" * {} (-{})", self.body, delta.human());
|
||||
return format!("[o] {} (-{})", self.body, delta.human());
|
||||
}
|
||||
} else {
|
||||
return format!(" * {}", self.body);
|
||||
return format!("[*] {}", self.body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_human_duration(input: &str) -> Result<Duration, Error> {
|
||||
let mut secs: i64 = 0;
|
||||
println!("{}", input);
|
||||
|
||||
for (token, mult) in [("d", 60 * 60 * 24), ("h", 60 * 60), ("m", 60)] {
|
||||
let re = Regex::new(format!("((?:-|)[0-9]+){token}", token = token).as_str())?;
|
||||
|
|
Loading…
Reference in a new issue