forked from janek/mostr
1
0
Fork 0

style: align command match branches

This commit is contained in:
xeruf 2024-08-08 18:16:25 +03:00
parent b62ec6fd39
commit c492d64d9e
1 changed files with 25 additions and 28 deletions

View File

@ -294,7 +294,7 @@ async fn main() {
continue; continue;
}, },
Some(',') => { Some(',') =>
match arg { match arg {
None => { None => {
tasks.get_current_task().map_or_else( tasks.get_current_task().map_or_else(
@ -305,7 +305,6 @@ async fn main() {
} }
Some(arg) => tasks.make_note(arg), Some(arg) => tasks.make_note(arg),
} }
}
Some('>') => { Some('>') => {
tasks.update_state(&arg_default, State::Done); tasks.update_state(&arg_default, State::Done);
@ -325,14 +324,15 @@ async fn main() {
tasks.set_state_filter(arg.map(|s| s.to_string())); tasks.set_state_filter(arg.map(|s| s.to_string()));
} }
Some('!') => match tasks.get_position() { Some('!') =>
match tasks.get_position() {
None => warn!("First select a task to set its state!"), None => warn!("First select a task to set its state!"),
Some(id) => { Some(id) => {
tasks.set_state_for_with(id, arg_default); tasks.set_state_for_with(id, arg_default);
} }
}, }
Some('#') => { Some('#') =>
match arg { match arg {
Some(arg) => tasks.set_tag(arg.to_string()), Some(arg) => tasks.set_tag(arg.to_string()),
None => { None => {
@ -340,23 +340,21 @@ async fn main() {
continue; continue;
} }
} }
}
Some('+') => { Some('+') =>
match arg { match arg {
Some(arg) => tasks.add_tag(arg.to_string()), Some(arg) => tasks.add_tag(arg.to_string()),
None => tasks.clear_filter() None => tasks.clear_filter()
} }
}
Some('-') => { Some('-') =>
match arg { match arg {
Some(arg) => tasks.remove_tag(arg), Some(arg) => tasks.remove_tag(arg),
None => tasks.clear_filter() None => tasks.clear_filter()
} }
}
Some('*') => match arg { Some('*') =>
match arg {
Some(arg) => { Some(arg) => {
if let Ok(num) = arg.parse::<i64>() { if let Ok(num) = arg.parse::<i64>() {
tasks.track_at(Timestamp::from(Timestamp::now().as_u64().saturating_add_signed(num))); tasks.track_at(Timestamp::from(Timestamp::now().as_u64().saturating_add_signed(num)));
@ -368,7 +366,7 @@ async fn main() {
} }
None => { None => {
println!("{}", tasks.times_tracked()); println!("{}", tasks.times_tracked());
continue continue;
} }
} }
@ -422,7 +420,7 @@ async fn main() {
} }
} }
_ => { _ =>
if Regex::new("^wss?://").unwrap().is_match(&input) { if Regex::new("^wss?://").unwrap().is_match(&input) {
tasks.move_to(None); tasks.move_to(None);
let mut new_relay = relays.keys().find(|key| key.as_str().starts_with(&input)).cloned(); let mut new_relay = relays.keys().find(|key| key.as_str().starts_with(&input)).cloned();
@ -446,7 +444,6 @@ async fn main() {
tasks.filter_or_create(&input); tasks.filter_or_create(&input);
} }
} }
}
or_print(tasks.print_tasks()); or_print(tasks.print_tasks());
} }
Some(Err(e)) => warn!("{}", e), Some(Err(e)) => warn!("{}", e),