-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBookTasks.yml
104 lines (87 loc) · 2.81 KB
/
BookTasks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
version: '3'
tasks:
completed:
desc: Move existing book to booklist 'completed'.
summary: |
Move existing book to booklist 'completed'.
Required variables:
-------------------
* BOOK: Path to content file of a book.
Example:
--------
> BOOK=./content/books/978-3-641-26688-2.md task {{.TASK}}
vars:
BOOK_DIRECTORY:
sh: "dirname {{.BOOK}}"
cmds:
- task: _update-booklist
vars:
BOOKLIST: "completed"
TARGET: '{{.BOOK}}'
- yq --front-matter=process -i '.date = now' {{.BOOK}}
- cp archetypes/review.md.dist {{.BOOK_DIRECTORY}}/review.md
- task: _add-to-vcs
vars:
REF: '{{.BOOK_DIRECTORY}}/'
reserve:
desc: Mark existing book (in booklist 'wishlist') as reserved.
summary: |
Mark existing book (in booklist 'wishlist') as reserved.
Required variables:
-------------------
* BOOK: Path to content file of a book.
Example:
--------
> BOOK=./content/books/978-3-641-26688-2.md task {{.TASK}}
cmds:
- yq --front-matter=process -i '.params.isReserved = true' {{.BOOK}}
search:
desc: Search book in content repository.
summary: |
Search book in content repository.
Required variables:
-------------------
* TERM: Term of the book to search for, e.g. title, isbn.
Example:
--------
> TERM='Der Name der Rose' task {{.TASK}}
cmds:
- grep --include=\*.md -Rwl './content/books' -e '{{.TERM}}'
start-reading:
desc: Move existing book to booklist 'currently-reading'.
summary: |
Move existing book to booklist 'currently-reading'.
Required variables:
-------------------
* BOOK: Path to content file of a book.
Example:
-------
> BOOK=./content/books/978-3-641-26688-2.md task {{.TASK}}
cmds:
- yq --front-matter=process -i '.booklists = ["currently-reading"]' {{.BOOK}}
- yq --front-matter=process -i '.date = now' {{.BOOK}}
unread:
desc: Move existing book (from booklist 'wishlist') to booklist 'unread'.
summary: |
Move existing book (from booklist 'wishlist') to booklist 'unread'.
Required variables:
-------------------
* BOOK: Path to content file of a book.
Example:
--------
> BOOK=./content/books/978-3-641-26688-2.md task {{.TASK}}
cmds:
- task: _update-booklist
vars:
BOOKLIST: "unread"
TARGET: '{{.BOOK}}'
- yq --front-matter=process -i 'del(.isReserved)' {{.BOOK}}
- yq --front-matter=process -i '.date = now' {{.BOOK}}
_add-to-vcs:
internal: true
cmds:
- git add {{.REF}}
_update-booklist:
internal: true
cmds:
- yq --front-matter=process -i '.booklists = ["{{.BOOKLIST}}"]' {{.TARGET}}