forked from janek/mostr
1
0
Fork 0

feat(main): properly apply input trimming

This commit is contained in:
xeruf 2024-08-10 18:10:40 +03:00
parent b03ad00b6a
commit ae2172c8f2
2 changed files with 15 additions and 8 deletions

View File

@ -54,10 +54,16 @@ Using subtasks has two main advantages:
- ability to accumulate time tracked - ability to accumulate time tracked
- swiftly navigate between related tasks - swiftly navigate between related tasks
Managing a project with subtasks makes it continuously visible,
which is helpful if you want to be able to track time on the project itself
without a specific task,
Thus subtasks can be very useful for specific contexts, Thus subtasks can be very useful for specific contexts,
for example a project or a specific place. for example a project or a specific place.
On the other hand, related tasks like chores On the other hand, related tasks like chores
should be grouped with a tag instead. should be grouped with a tag instead.
Similarly for projects which are only sporadically worked on
when a specific task comes up, so they do not clutter the list.
### Collaboration ### Collaboration
@ -86,7 +92,7 @@ To stop time-tracking completely, simply move to the root of all tasks.
`TASK` creation syntax: `NAME: TAG1 TAG2 ...` `TASK` creation syntax: `NAME: TAG1 TAG2 ...`
- `TASK` - create task - `TASK` - create task (prefix with space if you want a task to start with a command character)
- `.` - clear filters and reload - `.` - clear filters and reload
- `.TASK` - `.TASK`
+ activate task by id + activate task by id
@ -96,7 +102,7 @@ To stop time-tracking completely, simply move to the root of all tasks.
- `/[TEXT]` - like `.`, but never creates a task - `/[TEXT]` - like `.`, but never creates a task
- `|[TASK]` - (un)mark current task as procedure or create and activate a new task procedure (where subtasks automatically depend on the previously created task) - `|[TASK]` - (un)mark current task as procedure or create and activate a new task procedure (where subtasks automatically depend on the previously created task)
Dots can be repeated to move to parent tasks. Dots and slashes can be repeated to move to parent tasks.
- `:[IND][COL]` - add property column COL at IND or end, if it already exists remove property column COL or IND (1-indexed) - `:[IND][COL]` - add property column COL at IND or end, if it already exists remove property column COL or IND (1-indexed)
- `*[TIME]` - add timetracking with the specified offset (empty: list tracked times) - `*[TIME]` - add timetracking with the specified offset (empty: list tracked times)
@ -105,7 +111,7 @@ Dots can be repeated to move to parent tasks.
- `!TEXT` - set state for current task from text - `!TEXT` - set state for current task from text
- `,TEXT` - add text note (comment / description) - `,TEXT` - add text note (comment / description)
- `@` - undoes last action (moving in place or upwards or waiting a minute confirms pending actions) - `@` - undoes last action (moving in place or upwards or waiting a minute confirms pending actions)
- `wss://...` - switch or subscribe to relay - `wss://...` - switch or subscribe to relay (prefix with space to forcibly add a new one)
Property Filters: Property Filters:

View File

@ -284,8 +284,7 @@ async fn main() {
if remaining.is_empty() { if remaining.is_empty() {
tasks.remove_column(index); tasks.remove_column(index);
} else { } else {
let value = input[2..].trim().to_string(); tasks.add_or_remove_property_column_at_index(remaining, index);
tasks.add_or_remove_property_column_at_index(value, index);
} }
} else if let Some(arg) = arg { } else if let Some(arg) = arg {
tasks.add_or_remove_property_column(arg); tasks.add_or_remove_property_column(arg);
@ -403,7 +402,8 @@ async fn main() {
dots += 1; dots += 1;
pos = tasks.get_parent(pos).cloned(); pos = tasks.get_parent(pos).cloned();
} }
let slice = &input[dots..]; let slice = input[dots..].trim();
tasks.move_to(pos); tasks.move_to(pos);
if slice.is_empty() { if slice.is_empty() {
if dots > 1 { if dots > 1 {
@ -423,7 +423,8 @@ async fn main() {
dots += 1; dots += 1;
pos = tasks.get_parent(pos).cloned(); pos = tasks.get_parent(pos).cloned();
} }
let slice = &input[dots..].to_ascii_lowercase(); let slice = &input[dots..].trim().to_ascii_lowercase();
if slice.is_empty() { if slice.is_empty() {
tasks.move_to(pos); tasks.move_to(pos);
} else if let Ok(depth) = slice.parse::<i8>() { } else if let Ok(depth) = slice.parse::<i8>() {
@ -447,7 +448,7 @@ async fn main() {
} }
_ => _ =>
if Regex::new("^wss?://").unwrap().is_match(&input) { if Regex::new("^wss?://").unwrap().is_match(&input.trim()) {
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();
if new_relay.is_none() { if new_relay.is_none() {