aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-07 20:00:48 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-07 20:00:48 +0200
commitfaee6e1809594f8f1243002e75f2cb611ac22877 (patch)
tree08d1254fa1e19513d437ecdb8ac1e9eb76767c63
parente20cc1ee157fd287a0d409d7ae7ea7323444b4ac (diff)
downloadlbsd-faee6e1809594f8f1243002e75f2cb611ac22877.tar.gz
Dillo: Add 'bm' script
bm automatically re-arranges new bookmarks.
-rwxr-xr-xhome/john/.dillo/bm27
1 files changed, 27 insertions, 0 deletions
diff --git a/home/john/.dillo/bm b/home/john/.dillo/bm
new file mode 100755
index 0000000..cc26f23
--- /dev/null
+++ b/home/john/.dillo/bm
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# bm -- re-arrange dillo bookmarks
+
+awk -F: '
+ /^s0 / {
+ sub(/^s0 /, "")
+ new[i++] = $0
+ next
+ }
+ {
+ print
+ }
+ /^:/ {
+ sub(/^ */, "", $3)
+ section[$3] = $2
+ }
+ END {
+ if(section["Archive"]==""){
+ print "error: section Archive not found" > "/dev/stderr"
+ exit 1
+ }
+ for(j = 0; j<i; j++)
+ print section["Archive"] " " new[j]
+ }
+' ~/.dillo/bm.txt > ~/.dillo/bm.tmp &&
+mv ~/.dillo/bm.tmp ~/.dillo/bm.txt