Skip to content

Commit 490e0d6

Browse files
committed
Docs: Explain edit command, add example on how to fix import mistakes
1 parent 891ea5d commit 490e0d6

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

docs-source/import.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,3 +214,36 @@ Seen at [discussions.apple.com/thread/8570915](
214214
echo $task | tasklite importjson
215215
done
216216
```
217+
218+
219+
## Fixing Mistakes
220+
221+
It's easy to write a short shell script to fix any mistakes
222+
you might have made during the import process.
223+
224+
In following example I forgot to use the metadata field `end`
225+
to set the `closed_utc` column, but used the current date instead.
226+
227+
As I deleted all metadata afterwards,
228+
I now need to extract the field from an old backup.
229+
In the meantime I changed some `closed_utc` fields and therefore I can't fully automate it.
230+
A neat little trick I came up with is to automatically paste the correct value
231+
into the clipboard, so I only have to insert it at the right location.
232+
233+
A [fish](https://fishshell.com/) script to fix the mistake could look like this:
234+
235+
```fish
236+
sqlite3 \
237+
~/TaskLite/main.db \
238+
"SELECT ulid FROM tasks WHERE closed_utc LIKE '%2024-02-26%'" \
239+
| while read ulid \
240+
; echo "$ulid" \
241+
; and \
242+
sqlite3 \
243+
~/TaskLite/backups/2024-02-14t1949.db \
244+
"SELECT json_extract(metadata, '\$.end') FROM tasks WHERE ulid == '$ulid'" \
245+
| tee /dev/tty \
246+
| pbcopy \
247+
; and tl edit "$ulid" \
248+
; end
249+
```

docs-source/usage/cli.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
---
66

77

8+
## Help
9+
10+
For a full overview of all supported subcommands run:
11+
12+
```sh
13+
tasklite help
14+
```
15+
16+
![Screenshot of CLI output of `help` command](../images/help.svg)
17+
18+
819
## Add
920

1021
To add a task run:
@@ -30,15 +41,28 @@ The tags and special commands must be the last parameters,
3041
but their order doesn't matter.
3142

3243

33-
## Help
44+
## Edit
3445

35-
For a full overview of all supported subcommands run:
46+
Existing tasks can be easily edited in their YAML representation:
3647

3748
```sh
38-
tasklite help
49+
tl edit 01hwcw6s1kzakd5pje218zmtpt
3950
```
4051

41-
![Screenshot of CLI output of `help` command](../images/help.svg)
52+
This will open your default editor,
53+
as specified in the environment variables `$VISUAL` or `$EDITOR`.
54+
You can then easily edit existing fields and add new fields.
55+
56+
This feature allows for a powerful batch editing workflow.
57+
Use an SQL query to select a subsection of your tasks
58+
and then edit all of them one by one:
59+
60+
```bash
61+
sqlite3 \
62+
~/TaskLite/main.db \
63+
"SELECT ulid FROM tasks WHERE metadata LIKE '%sprint%'" \
64+
| while read ulid; do tl edit $ulid; done
65+
```
4266

4367

4468
## Context / Views

0 commit comments

Comments
 (0)