-
Notifications
You must be signed in to change notification settings - Fork 0
/
Adefaults
executable file
·49 lines (43 loc) · 956 Bytes
/
Adefaults
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
#!/bin/bash
9p read acme/log | while read line; do
winid=$(echo "$line" | cut -d' ' -f1)
action=$(echo "$line" | cut -d' ' -f2)
fname=$(echo "$line" | cut -d' ' -f3-)
if [[ "$action" != "new" ]]; then
continue
fi
if [[ -d "$fname" ]]; then
cd "$fname" >/dev/null 2>&1 || continue
# Directory listing
# If it's in a git repo, add a few git commands to the tag
if git status >/dev/null 2>&1; then
printf "Gci Gpush " | 9p write acme/$winid/tag
fi
cd "$HOME" # Need to cd somewhere else so unmounting things works
else
# Regular file
(
printf " |I- |I+ "
case "$fname" in
*.beancount)
printf '[fava $%%] :$ '
;;
*.md|*/guide)
printf "|fmt |Check"
;;
*.go)
printf "Lfmt Ldef Lrefs "
;;
*/go.mod)
printf "Lws+ "
;;
*.py)
printf "[Edit ,x/ /c/ /] "
;;
*/COMMIT_EDITMSG)
printf "|fmt "
;;
esac
) | 9p write acme/$winid/tag
fi
done