feat(main): enable manual state updates

This commit is contained in:
xeruf 2024-07-29 11:15:13 +03:00
parent 8e7b8d3e66
commit 6de7920af1
2 changed files with 26 additions and 11 deletions

View File

@ -36,10 +36,14 @@ Dots can be repeated to move to parent tasks
- `:[IND][COL]` - add / remove property column COL to IND or end
- `>[TEXT]` - Complete active task and move to parent, with optional state description
- `<[TEXT]` - Close active task and move to parent, with optional state description
- `#TAG` - filter by tag
- `?TAG` - filter by state (type or description)
- `|TEXT` - Set state for current task from text (also aliased to `/` for now)
- `-TEXT` - add text note (comment / description)
Property Filters:
- `#TAG` - filter by tag
- `?TAG` - filter by state (type or description) - plain `?` to reset
State descriptions can be used for example for Kanban columns.
An active tag or state filter will also create new tasks with those corresponding attributes.

View File

@ -249,15 +249,26 @@ async fn main() {
Some('-') => tasks.add_note(arg),
Some('>') | Some('<') => {
tasks.update_state(arg, |_| {
Some(if op.unwrap() == '<' {
State::Closed
} else {
State::Done
})
});
tasks.move_up()
Some('>') => {
tasks.update_state(arg, |_| Some(State::Done));
tasks.move_up();
}
Some('<') => {
tasks.update_state(arg, |_| Some(State::Closed));
tasks.move_up();
}
Some('|') | Some('/') => {
match tasks.get_position() {
None => {
println!("First select a task to set its state!");
}
Some(id) => {
tasks.set_state_for(&id, arg);
tasks.move_to(tasks.get_position());
}
}
}
Some('#') => {