agendafs
A filesystem for your calendar.
git clone git://mccd.space/agendafs| Log | Files | Refs | README | LICENSE | Mail | Website |
agendafs-examples.7.scd (2407B)
1 AGENDAFS-EXAMPLES(7)
2
3 # NAME
4
5 agendafs-examples - Ways to use agendafs
6
7 # Description
8
9 Agendafs can be combined with other tools to build your own *Personal
10 Knowledge Management* system. With so much power at your hands, it can
11 be hard to know what to do with it.
12
13 Below are some inspiration to get you started.
14
15 # Integrating with lf
16
17 _lf_(1) is a a terminal file manager available on most UNIX systems. It
18 works particularly well with agendafs.
19
20 ## Showing categories in the promptfmt.
21
22 Categories are available from _getfattr_(1). The _lf_ prompt can be updated
23 to display the current categories of the selected file with three lines of
24 configuration added to lfrc.
25
26 ```
27 cmd on-select &{{
28 lf -remote "send $id set promptfmt \"%d $(getfattr -n user.categories --only-values "$f")\""
29 }}
30 ```
31
32 ## Showing class and status in the custom info
33
34 The following script uses _awk_(1) to parse a directory of files and updates
35 _lf_(1) to display a notification if a file is public and/or a draft
36
37 ```
38 #!/usr/bin/sh
39 cd "$(dirname "$1")"
40
41 result=$(getfattr -d * | awk '
42 /^# file: / {
43 file = substr($0, 9);
44 is_private = 0;
45 is_draft = 0;
46 }
47
48 /^user.class="private"/ {
49 is_private = 1;
50 }
51
52 /^user.status="draft"/ {
53 is_draft = 1;
54 }
55
56 END {
57 for (f in files) {
58 is_private = (files[f] ~ /user.class="private"/);
59 is_draft = (files[f] ~ /user.status="draft"/);
60
61 # Build the custom info string.
62 info = "";
63 if (is_private) {
64 info = info "p,";
65 }
66 if (is_draft) {
67 info = info "d,";
68 }
69 if (length(info) > 0) {
70 info = substr(info, 1, length(info) - 1);
71 }
72 if (length(info) > 0) {
73 printf "addcustominfo \"%s\" \"%s\"; ", f, info;
74 }
75 }
76 }
77 {
78 if ($0 ~ /^# file: /) {
79 file = substr($0, 9);
80 files[file] = "";
81 } else if (file != "") {
82 files[file] = files[file] " " $0;
83 }
84 }
85 ')
86
87 if [ -n "$result" ]; then
88 lf -remote "send $id :$result"
89 fi
90 ```
91
92 Add the script to $PATH along with the following to your lfrc:
93
94 ```
95 set info custom
96 cmd on-cd %{{
97 lf_show_status "$1"
98 }}
99 cmd on-init %{{
100 lf_show_status "$1"
101 }}
102 ```
103