* This uses the gawk script from folder contrib
* It can be invoked as a substitute to `less`
---
lessgmi | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100755 lessgmi
diff --git a/lessgmi b/lessgmi
new file mode 100755
index 0000000..76f54df
--- /dev/null+++ b/lessgmi
@@ -0,0 +1,35 @@
+#!/bin/sh++# A wrapper around `less` that can color .gmi files++if test $(which gawk)+then+ # `gawk` is present, use it+ _AWK=gawk+ # TODO: Official install is probably /usr/share/gmi?+ _SCRIPT=contrib/gmi_color_gawk.awk+else+ # `gawk` is missing+ # TODO: fall back to plain `awk`, for the moment fall-back on plain `less`+ less $*+ exit 0+fi++# test if stdin is a tty+if test -t 0+then+ # Command example: `./lessgmi README.gmi`+ if [ -z "$1" ]+ then+ # Case of no args, invoke `less` to display the error and help+ echo "error: Missing filename"+ exit 1+ else+ # TODO: This assumes the first argument is the file, can be+ # any of the arguments+ $_AWK -f $_SCRIPT $1 | less --raw $2 $3 $4 $5 $6 $7 $8 $9+ fi+else+ # Command example: `cat README.gmi | ./lessgmi`+ $_AWK -f $_SCRIPT | less --raw $*+fi
--
2.25.1