dot

packages and services management
Log | Files | Refs | README

commit 89256c4a84eca40b2d66e4e29e2183d6c6fd597b
parent b0a7c5d1681f41c7761ec4c3538520e2acecf666
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun, 21 May 2017 13:12:27 +0200

ii-filter-3 is perfect

Diffstat:
Mbin/ii-filter-3 | 44+++++++++++++++++++++++++++++++++++++-------
Mbin/manpager | 3+--
2 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/bin/ii-filter-3 b/bin/ii-filter-3 @@ -1,25 +1,55 @@ # http://tools.suckless.org/ii -gawk ' +awk ' +BEGIN { + WIDTH = 80 - 17; +} + { last = date; date = $1; } date != last { - printf("%s ---------------------------------------------\n", date); + printf("----------------------------------"); + printf(" %s ", date); + printf("----------------------------------\n") } { - if ($3 ~ "<.*>") { + if ($3 ~ "<.*>" || $3 ~ "-!-") { sub("<", "", $3); sub(">", "", $3); - printf("%s %10s ", $2, $3); - sub("[^ ]* *[^ ]* *[^ ]*", ""); + + if (nick != $3) { + printf("\n"); + printf("%s %10s ", $2, $3); + nick = $3; + } else { + printf("%s %10s ", $2, ""); + } + + sub("[^ ]* [^ ]* [^ ]* ", ""); + } else { printf("%s %10s ", $2, ""); - sub("[^ ]* *[^ ]*", ""); + sub("[^ ]* [^ ]* ", ""); + } + + sub("^\001ACTION ", "~~ "); + sub("\001$", " ~~"); + + for (offset = 0; length($0) > 0; offset = 17) { + row = substr($0, 1, WIDTH); + + if (length(row) >= WIDTH) + sub(" [^ ]*$", "", row); + + $0 = substr($0, length(row) + 1); + sub(" *", ""); + + printf("%" offset "s%s\n", "", row); } } -' +' "$@" diff --git a/bin/manpager b/bin/manpager @@ -1,4 +1,3 @@ tmp=`mktemp` [ $# -gt 0 ] && sed 's/.//g' "$1" > "$tmp" -exec $EDITOR -R "$tmp" < /dev/tty - +exec $EDITOR "$tmp" < /dev/tty