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 EOF
29 fi
30 nvim "${MEM_DIR}/${YEAR}.md"
31
32# View memory entry year with glow
33[group('notes')]
34viewmem year:
35 #!/usr/bin/env bash
36 MEM_DIR="${HOME}/nextcloud/notes/memories"
37 YEAR={{ year }}
38 glow -p "${MEM_DIR}/${YEAR}.md"
39
40# List all memory entry years
41[group('notes')]
42lsmems:
43 #!/usr/bin/env bash
44 MEM_DIR="${HOME}/nextcloud/notes/memories"
45 echo "# Memory years" | gum format -t markdown
46 /bin/ls "$MEM_DIR" | xargs -I _ printf "- %s\n" _ | gum format -t markdown
47
48# New private tech note
49[group('notes')]
50newtechnote filename:
51 #!/usr/bin/env bash
52 FILENAME={{ filename }}
53 TECHNOTE_DIR="${HOME}/nextcloud/notes/tech"
54 nvim "${TECHNOTE_DIR}/${FILENAME}.md"
55
56# View private tech note with glow
57[group('notes')]
58viewtechnote filename:
59 #!/usr/bin/env bash
60 FILENAME={{ filename }}
61 TECHNOTE_DIR="${HOME}/nextcloud/notes/tech"
62 glow -p "${TECHNOTE_DIR}/${FILENAME}.md"
63
64# List all private tech notes
65[group('notes')]
66lstechnotes:
67 #!/usr/bin/env bash
68 TECHNOTE_DIR="${HOME}/nextcloud/notes/tech"
69 echo "# Tech notes" | gum format -t markdown
70 /bin/ls "$TECHNOTE_DIR" | xargs -I _ printf "- %s\n" _ | gum format -t markdown
71
72# vim: ts=4 sts=4 sw=4 et ft=just