Compare commits

...

2 commits

Author SHA1 Message Date
xeruf
3749f72048 refactor(main): optimize feedback for (( command 2024-11-11 01:21:18 +01:00
xeruf
d1735476cc fix(main): improve feedback for (( command 2024-11-11 01:19:27 +01:00
2 changed files with 19 additions and 9 deletions

View file

@ -552,7 +552,7 @@ async fn main() -> Result<()> {
.inspect_err(|e| warn!("Invalid Priority {arg}: {e}")).ok()
.map(|p: Prio| p * (if arg.len() < 2 { 10 } else { 1 })));
}
},
}
}
}
@ -649,13 +649,23 @@ async fn main() -> Result<()> {
let (first, remaining) = arg.split_at(1);
if first == "(" {
let mut max = usize::MAX;
match remaining.parse::<usize>() {
Ok(number) => max = number,
Err(e) => warn!("Unsure what to do with {:?}", e),
if remaining.len() > 0 {
match remaining.parse::<usize>() {
Ok(number) => max = number,
Err(e) => warn!("Ignoring extra {:?}: {}\nSyntax: ((INT", remaining, e),
}
}
let (label, times) = tasks.times_tracked();
println!("{}\n{}", label.italic(),
times.rev().take(max).collect_vec().iter().rev().join("\n"));
let vec = times.rev().take(max).collect_vec();
println!("{}\n{}",
if vec.is_empty() {
label
} else {
format!("{} {}",
if max == usize::MAX { "All".to_string() } else { format!("Latest {max} entries of") },
label)
},
vec.iter().rev().join("\n"));
} else if let Ok(key) = PublicKey::parse(arg) { // TODO also match name
let (label, mut times) = tasks.times_tracked_for(&key);
println!("{}\n{}", label.italic(),

View file

@ -278,7 +278,7 @@ impl TasksRelay {
}
}
Some(id) => {
// TODO consider pubkey
// TODO show current recursive with pubkey
let ids = vec![id];
let history =
self.history.iter().flat_map(|(key, set)| {