forked from janek/mostr
1
0
Fork 0

fix(main): only parse single-digit view depths

This commit is contained in:
xeruf 2024-10-15 03:28:40 +02:00
parent bdb8b6e814
commit 74fff5a2b1
1 changed files with 11 additions and 6 deletions

View File

@ -686,13 +686,18 @@ async fn main() -> Result<()> {
} else {
tasks.clear_filters();
}
} else if let Ok(depth) = remaining.parse::<usize>() {
if pos != tasks.get_position_ref() {
tasks.move_to(pos.cloned());
}
tasks.set_view_depth(depth);
} else {
tasks.filter_or_create(pos.cloned().as_ref(), &remaining).map(|id| tasks.move_to(Some(id)));
match remaining.parse::<usize>() {
Ok(depth) if depth < 10 => {
if pos != tasks.get_position_ref() {
tasks.move_to(pos.cloned());
}
tasks.set_view_depth(depth);
}
_ => {
tasks.filter_or_create(pos.cloned().as_ref(), &remaining).map(|id| tasks.move_to(Some(id)));
}
}
}
}