justfiles for automating various tasks on my workstation
1# Create new note category
2[group('notes')]
3newnotecat category:
4 #!/usr/bin/env bash
5 NOTES_DIR="${HOME}/nextcloud/notes"
6 CATEGORY={{ category }}
7 mkdir -p "${NOTES_DIR}/${CATEGORY}"
8
9# List note categories
10[group('notes')]
11lsnotecats:
12 #!/usr/bin/env bash
13 NOTES_DIR="${HOME}/nextcloud/notes"
14 echo "# Note categories" | gum format -t markdown
15 /bin/ls "$NOTES_DIR" | xargs -I _ printf "- %s/\n" _ | gum format -t markdown
16
17# New memory recollection
18[group('notes')]
19newmem year:
20 #!/usr/bin/env bash
21 MEM_DIR="${HOME}/nextcloud/notes/memories"
22 YEAR={{ year }}
23 if [ ! -f "${MEM_DIR}/${YEAR}.md" ]; then
24 cat <<EOF >"${MEM_DIR}/${YEAR}.md"
25 $YEAR
26 ========================
27
28
29 EOF
30 fi
31 nvim "${MEM_DIR}/${YEAR}.md"
32
33# View memory entry year with glow
34[group('notes')]
35viewmem year:
36 #!/usr/bin/env bash
37 MEM_DIR="${HOME}/nextcloud/notes/memories"
38 YEAR={{ year }}
39 glow -p "${MEM_DIR}/${YEAR}.md"
40
41# List all memory entry years
42[group('notes')]
43lsmems:
44 #!/usr/bin/env bash
45 MEM_DIR="${HOME}/nextcloud/notes/memories"
46 echo "# Memory years" | gum format -t markdown
47 /bin/ls "$MEM_DIR" | xargs -I _ printf "- %s\n" _ | gum format -t markdown
48
49# New private tech note
50[group('notes')]
51newtechnote filename:
52 #!/usr/bin/env bash
53 FILENAME={{ filename }}
54 TECHNOTE_DIR="${HOME}/nextcloud/notes/tech"
55 nvim "${TECHNOTE_DIR}/${FILENAME}.md"
56
57# View private tech note with glow
58[group('notes')]
59viewtechnote filename:
60 #!/usr/bin/env bash
61 FILENAME={{ filename }}
62 TECHNOTE_DIR="${HOME}/nextcloud/notes/tech"
63 glow -p "${TECHNOTE_DIR}/${FILENAME}.md"
64
65# List all private tech notes
66[group('notes')]
67lstechnotes:
68 #!/usr/bin/env bash
69 TECHNOTE_DIR="${HOME}/nextcloud/notes/tech"
70 echo "# Tech notes" | gum format -t markdown
71 /bin/ls "$TECHNOTE_DIR" | xargs -I _ printf "- %s\n" _ | gum format -t markdown
72
73# vim: ts=4 sts=4 sw=4 et ft=just