Commit
+208 -208 +/-5 browse
1 | diff --git a/bin/dune b/bin/dune |
2 | index 6feb0e1..cb16adc 100644 |
3 | --- a/bin/dune |
4 | +++ b/bin/dune |
5 | @@ -7,7 +7,7 @@ |
6 | |
7 | (install |
8 | (section man) |
9 | - (files ../doc/note.1)) |
10 | + (files ../doc/note.7)) |
11 | (install |
12 | (section share) |
13 | (files ../completion/note)) |
14 | diff --git a/doc/note.1 b/doc/note.1 |
15 | deleted file mode 100644 |
16 | index 093b7ae..0000000 |
17 | --- a/doc/note.1 |
18 | +++ /dev/null |
19 | @@ -1,203 +0,0 @@ |
20 | - .TH "Note" 7 2020-09-09 |
21 | - .SH Note 🐪 |
22 | - .LP |
23 | - \f[CR]Note\f[R] is a simple CLI based note taking application. |
24 | - .SS The Anatomy of a Note |
25 | - .LP |
26 | - A note is a simple markdown document that contains zero or more instances of structured data encoded as YAML or JSON. Notes can optionally contain \f[CR]front-matter\f[R] at the head of each file, which is YAML or JSON enclosed by a pair of \f[CR]---\f[R]. |
27 | - .sp 1 |
28 | - .nf |
29 | - .ft CR |
30 | - --- |
31 | - title: This is a Note |
32 | - tags: [ocaml, programming] |
33 | - --- |
34 | - |
35 | - # Hello World! |
36 | - |
37 | - Today will be a nice day. |
38 | - .ft |
39 | - .fi |
40 | - .SS Configuration |
41 | - .LP |
42 | - The behavior of \f[CR]note\f[R] can be configured with yaml file stored in \f[CR]\(ti/.config/note/config.yaml\f[R] and configure itself per the XDG Base Directory |
43 | - \f[I]specification\f[R]. |
44 | - You can view the resolved configuration by running \f[CR]note config\f[R]: |
45 | - .sp 1 |
46 | - .nf |
47 | - .ft CR |
48 | - state_dir: /home/kevin/.local/share/note |
49 | - lock_file: /home/kevin/.local/share/note.lock |
50 | - editor: nvim |
51 | - on_modification: note_commit.sh |
52 | - .ft |
53 | - .fi |
54 | - .SS Structured Data |
55 | - .LP |
56 | - Notes that contain code blocks with structured data as well as front-matter are automatically parsed and exposed via the command API. |
57 | - .SS Example |
58 | - .sp 1 |
59 | - .nf |
60 | - .ft CR |
61 | - note create -stdin <<EOF |
62 | - |
63 | - # Musical Styles |
64 | - |
65 | - \(ga\(ga\(gayaml |
66 | - - style: Bomba |
67 | - influenced: |
68 | - - style: Plena |
69 | - - style: Reggaetón |
70 | - influenced: |
71 | - - style: Latin Trap |
72 | - - style: Bachatón |
73 | - \(ga\(ga\(ga |
74 | - EOF |
75 | - |
76 | - # Now let's inspect the code block with jq |
77 | - note cat -encoding json "Musical Styles" | jq .data[0] |
78 | - [ |
79 | - { |
80 | - "style": "Bomba", |
81 | - "influenced": [ |
82 | - { |
83 | - "style": "Plena" |
84 | - }, |
85 | - { |
86 | - "style": "Reggaetón", |
87 | - "influenced": [ |
88 | - { |
89 | - "style": "Latin Trap" |
90 | - }, |
91 | - { |
92 | - "style": "Bachatón" |
93 | - } |
94 | - ] |
95 | - } |
96 | - ] |
97 | - } |
98 | - ] |
99 | - .ft |
100 | - .fi |
101 | - .SS The State Directory |
102 | - .LP |
103 | - Each note is stored as a flat file inside the \f[CR]state_dir\f[R] with a slug that corresponds to the |
104 | - date (YYYYMMDD) on which it was created. If multiple notes are created on one day, an index will |
105 | - be appended to the file. |
106 | - .sp 1 |
107 | - .nf |
108 | - .ft CR |
109 | - $ tree \(ti/.local/share/note/ |
110 | - /home/kevin/.local/share/note/ |
111 | - ├── note-20200818-1.md |
112 | - ├── note-20200819-1.md |
113 | - ├── note-20200819-2.md |
114 | - └── note-20200819-3.md |
115 | - .ft |
116 | - .fi |
117 | - .SS Persisting Notes with Git |
118 | - .LP |
119 | - If the \f[CR]on_modification\f[R] configuration option is set it will be called each time a note is modified. This feature can be used to automatically commit your notes to a git repository with a script such as below: |
120 | - .sp 1 |
121 | - .nf |
122 | - .ft CR |
123 | - #!/bin/bash |
124 | - # This is an example script that can be used in conjunction with the |
125 | - # on_modification config option to commit every note change to a git |
126 | - # repository. You'll need to place it somewhere on your $PATH. This |
127 | - # script assumes that your state_dir is also a git repository. |
128 | - set -e |
129 | - |
130 | - STATE_DIR="$(note config -get state_dir)" |
131 | - |
132 | - pushd "$STATE_DIR" |
133 | - git add --all |
134 | - git commit -m 'automated commit' |
135 | - popd |
136 | - .ft |
137 | - .fi |
138 | - .SS Web UI |
139 | - .LP |
140 | - Notes are stored in a format that is compatible with the static website generator |
141 | - \f[I]Hugo\f[R] |
142 | - and thus you can point your \f[CR]state_dir\f[R] to a Hugo content directory and get a web based interface for all of your notes. |
143 | - .SS Subcommands |
144 | - .SS Cat |
145 | - .LP |
146 | - Write one or more notes to stdout. By default the cat command will write every note to stdout as plain text however the encoding can be adjusted to \f[CR]yaml\f[R] or \f[CR]json\f[R] for consumption by other tools. |
147 | - .SS Examples |
148 | - .sp 1 |
149 | - .nf |
150 | - .ft CR |
151 | - # print the parsed content of the fuubar note |
152 | - note cat fuubar |
153 | - # write all commands as a json list |
154 | - note cat -encoding json |
155 | - .ft |
156 | - .fi |
157 | - .SS Config |
158 | - .LP |
159 | - Display the current configuration as inferred by Note. It is also possible to extract specific values by specifying a key value. |
160 | - .SS Examples |
161 | - .sp 1 |
162 | - .nf |
163 | - .ft CR |
164 | - # display the current configuration |
165 | - note config |
166 | - # extract a specific value from the configuration |
167 | - note config -get state_dir |
168 | - .ft |
169 | - .fi |
170 | - .SS Create |
171 | - .LP |
172 | - Create a new note and save it to disk in your configured \f[CR]state_dir\f[R]. The \f[CR]on_modification\f[R] call back will be invoked if the file is committed to disk. |
173 | - .SS Examples |
174 | - .sp 1 |
175 | - .nf |
176 | - .ft CR |
177 | - # create a new note with the given title and tags |
178 | - note create "Remember The Milk" groceries fuu bar |
179 | - # create a note by reading from stdin |
180 | - note create -stdin <<EOF |
181 | - # My Important Note |
182 | - |
183 | - Hello World! |
184 | - EOF |
185 | - # the title will be inferred from the heading |
186 | - note ls "My Important Note" |
187 | - .ft |
188 | - .fi |
189 | - .SS Delete |
190 | - .LP |
191 | - Delete the first note that matches the filter criteria. The \f[CR]on_modification\f[R] call back will be invoked if the note is deleted. |
192 | - .SS Examples |
193 | - .sp 1 |
194 | - .nf |
195 | - .ft CR |
196 | - # delete the note called fuubar |
197 | - |
198 | - note delete fuubar |
199 | - .ft |
200 | - .fi |
201 | - .SS Edit |
202 | - .LP |
203 | - Select a note that matches the filter criteria and open it in your \f[CR]$EDITOR\f[R]. The \f[CR]on_modification\f[R] call back will be invoked if the edited file differs from the original. |
204 | - .SS Examples |
205 | - .sp 1 |
206 | - .nf |
207 | - .ft CR |
208 | - # edit the fuubar note |
209 | - note edit fuubar |
210 | - .ft |
211 | - .fi |
212 | - .SS List |
213 | - .LP |
214 | - List notes that match the filter criteria, if no filter criteria is given all notes will be listed |
215 | - .SS Examples |
216 | - .sp 1 |
217 | - .nf |
218 | - .ft CR |
219 | - # list all notes |
220 | - note ls |
221 | - .ft |
222 | - .fi |
223 | diff --git a/doc/note.7 b/doc/note.7 |
224 | new file mode 100644 |
225 | index 0000000..093b7ae |
226 | --- /dev/null |
227 | +++ b/doc/note.7 |
228 | @@ -0,0 +1,203 @@ |
229 | + .TH "Note" 7 2020-09-09 |
230 | + .SH Note 🐪 |
231 | + .LP |
232 | + \f[CR]Note\f[R] is a simple CLI based note taking application. |
233 | + .SS The Anatomy of a Note |
234 | + .LP |
235 | + A note is a simple markdown document that contains zero or more instances of structured data encoded as YAML or JSON. Notes can optionally contain \f[CR]front-matter\f[R] at the head of each file, which is YAML or JSON enclosed by a pair of \f[CR]---\f[R]. |
236 | + .sp 1 |
237 | + .nf |
238 | + .ft CR |
239 | + --- |
240 | + title: This is a Note |
241 | + tags: [ocaml, programming] |
242 | + --- |
243 | + |
244 | + # Hello World! |
245 | + |
246 | + Today will be a nice day. |
247 | + .ft |
248 | + .fi |
249 | + .SS Configuration |
250 | + .LP |
251 | + The behavior of \f[CR]note\f[R] can be configured with yaml file stored in \f[CR]\(ti/.config/note/config.yaml\f[R] and configure itself per the XDG Base Directory |
252 | + \f[I]specification\f[R]. |
253 | + You can view the resolved configuration by running \f[CR]note config\f[R]: |
254 | + .sp 1 |
255 | + .nf |
256 | + .ft CR |
257 | + state_dir: /home/kevin/.local/share/note |
258 | + lock_file: /home/kevin/.local/share/note.lock |
259 | + editor: nvim |
260 | + on_modification: note_commit.sh |
261 | + .ft |
262 | + .fi |
263 | + .SS Structured Data |
264 | + .LP |
265 | + Notes that contain code blocks with structured data as well as front-matter are automatically parsed and exposed via the command API. |
266 | + .SS Example |
267 | + .sp 1 |
268 | + .nf |
269 | + .ft CR |
270 | + note create -stdin <<EOF |
271 | + |
272 | + # Musical Styles |
273 | + |
274 | + \(ga\(ga\(gayaml |
275 | + - style: Bomba |
276 | + influenced: |
277 | + - style: Plena |
278 | + - style: Reggaetón |
279 | + influenced: |
280 | + - style: Latin Trap |
281 | + - style: Bachatón |
282 | + \(ga\(ga\(ga |
283 | + EOF |
284 | + |
285 | + # Now let's inspect the code block with jq |
286 | + note cat -encoding json "Musical Styles" | jq .data[0] |
287 | + [ |
288 | + { |
289 | + "style": "Bomba", |
290 | + "influenced": [ |
291 | + { |
292 | + "style": "Plena" |
293 | + }, |
294 | + { |
295 | + "style": "Reggaetón", |
296 | + "influenced": [ |
297 | + { |
298 | + "style": "Latin Trap" |
299 | + }, |
300 | + { |
301 | + "style": "Bachatón" |
302 | + } |
303 | + ] |
304 | + } |
305 | + ] |
306 | + } |
307 | + ] |
308 | + .ft |
309 | + .fi |
310 | + .SS The State Directory |
311 | + .LP |
312 | + Each note is stored as a flat file inside the \f[CR]state_dir\f[R] with a slug that corresponds to the |
313 | + date (YYYYMMDD) on which it was created. If multiple notes are created on one day, an index will |
314 | + be appended to the file. |
315 | + .sp 1 |
316 | + .nf |
317 | + .ft CR |
318 | + $ tree \(ti/.local/share/note/ |
319 | + /home/kevin/.local/share/note/ |
320 | + ├── note-20200818-1.md |
321 | + ├── note-20200819-1.md |
322 | + ├── note-20200819-2.md |
323 | + └── note-20200819-3.md |
324 | + .ft |
325 | + .fi |
326 | + .SS Persisting Notes with Git |
327 | + .LP |
328 | + If the \f[CR]on_modification\f[R] configuration option is set it will be called each time a note is modified. This feature can be used to automatically commit your notes to a git repository with a script such as below: |
329 | + .sp 1 |
330 | + .nf |
331 | + .ft CR |
332 | + #!/bin/bash |
333 | + # This is an example script that can be used in conjunction with the |
334 | + # on_modification config option to commit every note change to a git |
335 | + # repository. You'll need to place it somewhere on your $PATH. This |
336 | + # script assumes that your state_dir is also a git repository. |
337 | + set -e |
338 | + |
339 | + STATE_DIR="$(note config -get state_dir)" |
340 | + |
341 | + pushd "$STATE_DIR" |
342 | + git add --all |
343 | + git commit -m 'automated commit' |
344 | + popd |
345 | + .ft |
346 | + .fi |
347 | + .SS Web UI |
348 | + .LP |
349 | + Notes are stored in a format that is compatible with the static website generator |
350 | + \f[I]Hugo\f[R] |
351 | + and thus you can point your \f[CR]state_dir\f[R] to a Hugo content directory and get a web based interface for all of your notes. |
352 | + .SS Subcommands |
353 | + .SS Cat |
354 | + .LP |
355 | + Write one or more notes to stdout. By default the cat command will write every note to stdout as plain text however the encoding can be adjusted to \f[CR]yaml\f[R] or \f[CR]json\f[R] for consumption by other tools. |
356 | + .SS Examples |
357 | + .sp 1 |
358 | + .nf |
359 | + .ft CR |
360 | + # print the parsed content of the fuubar note |
361 | + note cat fuubar |
362 | + # write all commands as a json list |
363 | + note cat -encoding json |
364 | + .ft |
365 | + .fi |
366 | + .SS Config |
367 | + .LP |
368 | + Display the current configuration as inferred by Note. It is also possible to extract specific values by specifying a key value. |
369 | + .SS Examples |
370 | + .sp 1 |
371 | + .nf |
372 | + .ft CR |
373 | + # display the current configuration |
374 | + note config |
375 | + # extract a specific value from the configuration |
376 | + note config -get state_dir |
377 | + .ft |
378 | + .fi |
379 | + .SS Create |
380 | + .LP |
381 | + Create a new note and save it to disk in your configured \f[CR]state_dir\f[R]. The \f[CR]on_modification\f[R] call back will be invoked if the file is committed to disk. |
382 | + .SS Examples |
383 | + .sp 1 |
384 | + .nf |
385 | + .ft CR |
386 | + # create a new note with the given title and tags |
387 | + note create "Remember The Milk" groceries fuu bar |
388 | + # create a note by reading from stdin |
389 | + note create -stdin <<EOF |
390 | + # My Important Note |
391 | + |
392 | + Hello World! |
393 | + EOF |
394 | + # the title will be inferred from the heading |
395 | + note ls "My Important Note" |
396 | + .ft |
397 | + .fi |
398 | + .SS Delete |
399 | + .LP |
400 | + Delete the first note that matches the filter criteria. The \f[CR]on_modification\f[R] call back will be invoked if the note is deleted. |
401 | + .SS Examples |
402 | + .sp 1 |
403 | + .nf |
404 | + .ft CR |
405 | + # delete the note called fuubar |
406 | + |
407 | + note delete fuubar |
408 | + .ft |
409 | + .fi |
410 | + .SS Edit |
411 | + .LP |
412 | + Select a note that matches the filter criteria and open it in your \f[CR]$EDITOR\f[R]. The \f[CR]on_modification\f[R] call back will be invoked if the edited file differs from the original. |
413 | + .SS Examples |
414 | + .sp 1 |
415 | + .nf |
416 | + .ft CR |
417 | + # edit the fuubar note |
418 | + note edit fuubar |
419 | + .ft |
420 | + .fi |
421 | + .SS List |
422 | + .LP |
423 | + List notes that match the filter criteria, if no filter criteria is given all notes will be listed |
424 | + .SS Examples |
425 | + .sp 1 |
426 | + .nf |
427 | + .ft CR |
428 | + # list all notes |
429 | + note ls |
430 | + .ft |
431 | + .fi |
432 | diff --git a/scripts/generate_build.sh b/scripts/generate_build.sh |
433 | index 1feed75..02b75af 100755 |
434 | --- a/scripts/generate_build.sh |
435 | +++ b/scripts/generate_build.sh |
436 | @@ -33,11 +33,11 @@ SOURCE="$(realpath "_build/install/default")" |
437 | mkdir -p "$PKG_PATH" |
438 | pushd "$PKG_PATH" |
439 | mkdir -p usr/bin |
440 | - mkdir -p usr/share/man/man1 |
441 | - cp "$SOURCE/man/man1/note.1" usr/share/man/man1/ |
442 | + mkdir -p usr/share/man/man7 |
443 | + cp "$SOURCE/man/man7/note.7" usr/share/man/man7/ |
444 | mkdir -p usr/share/bash-completion/completions |
445 | cp "$SOURCE/share/note/note" usr/share/bash-completion/completions/ |
446 | - gzip usr/share/man/man1/note.1 |
447 | + gzip usr/share/man/man7/note.7 |
448 | popd |
449 | |
450 | docker build -t "$PKG" -f "$DOCKER_FILE" . |
451 | diff --git a/scripts/generate_pkgbuild.sh b/scripts/generate_pkgbuild.sh |
452 | index 9e25950..6c9458d 100755 |
453 | --- a/scripts/generate_pkgbuild.sh |
454 | +++ b/scripts/generate_pkgbuild.sh |
455 | @@ -21,6 +21,6 @@ md5sums=($MD5SUM) |
456 | package() { |
457 | install -Dm755 usr/bin/note -t "\${pkgdir}/usr/bin/" |
458 | install -Dm644 usr/share/bash-completion/completions/note -t \${pkgdir}/usr/share/bash-completion/completions/ |
459 | - install -Dm644 usr/share/man/man1/note.1.gz -t \${pkgdir}/usr/share/man/man1/ |
460 | + install -Dm644 usr/share/man/man7/note.7.gz -t \${pkgdir}/usr/share/man/man7/ |
461 | } |
462 | EOF |