forked from janek/mostr
feat(main): enable filtering by author
This commit is contained in:
parent
9ad1243078
commit
d88cae4273
1 changed files with 18 additions and 8 deletions
26
src/main.rs
26
src/main.rs
|
@ -366,21 +366,31 @@ async fn main() {
|
||||||
tasks.move_up();
|
tasks.move_up();
|
||||||
}
|
}
|
||||||
|
|
||||||
Some('@') | Some('&') => {
|
Some('&') => {
|
||||||
tasks.undo();
|
tasks.undo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some('@') => {
|
||||||
|
let author = arg.and_then(|a| PublicKey::from_str(a).ok()).unwrap_or_else(|| keys.public_key());
|
||||||
|
info!("Filtering for events by {author}");
|
||||||
|
tasks.set_filter(
|
||||||
|
tasks.filtered_tasks(tasks.get_position())
|
||||||
|
.filter(|t| t.event.pubkey == author)
|
||||||
|
.map(|t| t.event.id)
|
||||||
|
.collect()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Some('*') => {
|
||||||
|
info!("Setting priority not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
Some('|') =>
|
Some('|') =>
|
||||||
match arg {
|
match arg {
|
||||||
None => match tasks.get_position() {
|
None => match tasks.get_position() {
|
||||||
None => {
|
None => {
|
||||||
info!("Filtering for Procedures");
|
tasks.set_state_filter(
|
||||||
tasks.set_filter(
|
StateFilter::State(State::Procedure.to_string()));
|
||||||
tasks.filtered_tasks(None)
|
|
||||||
.filter(|t| t.pure_state() == State::Procedure)
|
|
||||||
.map(|t| t.event.id)
|
|
||||||
.collect()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
Some(id) => {
|
Some(id) => {
|
||||||
tasks.set_state_for(id, "", State::Procedure);
|
tasks.set_state_for(id, "", State::Procedure);
|
||||||
|
|
Loading…
Add table
Reference in a new issue