From bfed2488ad5186b27782f06248dc5a59208701af Mon Sep 17 00:00:00 2001 From: Nikita Ivanov Date: Sat, 26 Aug 2023 14:10:53 +0200 Subject: [PATCH] Docs: add links to programs Resolves #71 Co-authored-by: ld991 <140622991+ld991@users.noreply.github.com> --- README.md | 58 ++++++++++++++++++++++++++++++------------- deptable/list.awk | 37 +++++++++++++++++++++++++-- deptable/markdown.sed | 19 +++++++++++--- deptable/roff.sed | 26 ++++++++++++++----- 4 files changed, 111 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index b23992b..856044c 100644 --- a/README.md +++ b/README.md @@ -43,23 +43,47 @@ For example, you only need either `elinks`, `lynx` or | File types | Programs | | ---- | ---- | -| any | `exiftool` `cat` | -| archive | `atool` | -| audio | `ffmpegthumbnailer` `ffmpeg` | -| diff | `colordiff` `delta` `diff-so-fancy` | -| directory | `ls` | -| font | `fontimage` | -| gpg-encrypted | `gpg` | -| html | `elinks` `lynx` `w3m` | -| image | `ueberzug` `chafa` | -| json | `jq` | -| markdown | `glow` `mdcat` | -| office | `libreoffice` | -| pdf | `pdftoppm` | -| svg | `convert` | -| text | `bat` `cat` `highlight` `source-highlight` | -| torrent | `transmission-show` | -| video | `ffmpegthumbnailer` | +| any | [exiftool][exiftool] cat | +| archive | [atool][atool] | +| audio | [ffmpegthumbnailer][ffmpegthumbnailer] [ffmpeg][ffmpeg] | +| diff | [colordiff][colordiff] [delta][delta] [diff-so-fancy][diff-so-fancy] | +| directory | ls | +| font | fontimage | +| gpg-encrypted | [gpg][gpg] | +| html | [elinks][elinks] [lynx][lynx] [w3m][w3m] | +| image | [ueberzug][ueberzug] [chafa][chafa] | +| json | [jq][jq] | +| markdown | [glow][glow] [mdcat][mdcat] | +| office | [libreoffice][libreoffice] | +| pdf | pdftoppm | +| svg | convert | +| text | bat cat [highlight][highlight] [source-highlight][source-highlight] | +| torrent | transmission-show | +| video | [ffmpegthumbnailer][ffmpegthumbnailer] | + +[ffmpegthumbnailer]: https://github.com/dirkvdb/ffmpegthumbnailer +[w3m]: https://w3m.sourceforge.net/ +[elinks]: http://elinks.cz/ +[fontforge]: https://fontforge.org +[exiftool]: https://github.com/exiftool/exiftool +[highlight]: https://gitlab.com/saalen/highlight +[chafa]: https://github.com/hpjansson/chafa +[gpg]: https://www.gnupg.org/ +[transmission]: https://transmissionbt.com/ +[delta]: https://github.com/dandavison/delta +[colordiff]: https://www.colordiff.org/ +[source-highlight]: https://www.gnu.org/software/src-highlite/ +[ueberzug]: https://github.com/seebye/ueberzug +[mdcat]: https://github.com/swsnr/mdcat +[glow]: https://github.com/charmbracelet/glow +[atool]: https://www.nongnu.org/atool/ +[lynx]: https://github.com/jpanther/lynx +[libreoffice]: https://www.libreoffice.org/ +[diff-so-fancy]: https://github.com/so-fancy/diff-so-fancy +[imagemagick]: https://imagemagick.org/ +[poppler]: https://poppler.freedesktop.org/ +[jq]: https://github.com/jqlang/jq +[ffmpeg]: https://ffmpeg.org/ diff --git a/deptable/list.awk b/deptable/list.awk index 276aeb5..42e5366 100755 --- a/deptable/list.awk +++ b/deptable/list.awk @@ -29,11 +29,36 @@ function process_file(file, i, line, arr, t, p, p_len) { t = arr[1] p_len = split(arr[2], p, /\s+/) - for (i = 1; i <= p_len; i++) - types[t][types_len[t]++] = p[i] + for (i = 1; i <= p_len; i++) { + types[t][types_len[t]++] = LINKS[p[i]] ? sprintf("[%s][%s]", p[i], p[i]) : p[i] + } } BEGIN { + LINKS["exiftool"] = "https://github.com/exiftool/exiftool" + LINKS["atool"] = "https://www.nongnu.org/atool/" + LINKS["ffmpegthumbnailer"] = "https://github.com/dirkvdb/ffmpegthumbnailer" + LINKS["ffmpeg"] = "https://ffmpeg.org/" + LINKS["colordiff"] = "https://www.colordiff.org/" + LINKS["delta"] = "https://github.com/dandavison/delta" + LINKS["diff-so-fancy"] = "https://github.com/so-fancy/diff-so-fancy" + LINKS["fontforge"] = "https://fontforge.org" + LINKS["gpg"] = "https://www.gnupg.org/" + LINKS["libreoffice"] = "https://www.libreoffice.org/" + LINKS["elinks"] = "http://elinks.cz/" + LINKS["lynx"] = "https://github.com/jpanther/lynx" + LINKS["w3m"] = "https://w3m.sourceforge.net/" + LINKS["ueberzug"] = "https://github.com/seebye/ueberzug" + LINKS["chafa"] = "https://github.com/hpjansson/chafa" + LINKS["jq"] = "https://github.com/jqlang/jq" + LINKS["glow"] = "https://github.com/charmbracelet/glow" + LINKS["mdcat"] = "https://github.com/swsnr/mdcat" + LINKS["poppler"] = "https://poppler.freedesktop.org/" + LINKS["imagemagick"] = "https://imagemagick.org/" + LINKS["highlight"] = "https://gitlab.com/saalen/highlight" + LINKS["source-highlight"] = "https://www.gnu.org/software/src-highlite/" + LINKS["transmission"] = "https://transmissionbt.com/" + for (i = 1; i < ARGC; i++) process_file(ARGV[i]) @@ -41,4 +66,12 @@ BEGIN { s = s sprintf("%s\t%s\n", t, join(types[t], " ")) printf "%s", s | "sort" + close("sort") + + print "" + for (k in LINKS) { + if (!LINKS[k]) + continue + printf ">\t%s\t%s\n", k, LINKS[k] + } } diff --git a/deptable/markdown.sed b/deptable/markdown.sed index 539366d..da65652 100755 --- a/deptable/markdown.sed +++ b/deptable/markdown.sed @@ -5,11 +5,22 @@ | File types | Programs |\ | ---- | ---- | +# Format links +/^>/ { + s/>\t/[/ + s/\t/]: / + be +} + # Format rows -s/ /` `/g -s/\t/ | `/ -s/^/| / -s/$/` |/ +/^$/! { + s/ / /g + s/\t/ | / + s/^/| / + s/$/ |/ +} + +:e # Add a newline at the end $a\ diff --git a/deptable/roff.sed b/deptable/roff.sed index 3554573..2827e43 100755 --- a/deptable/roff.sed +++ b/deptable/roff.sed @@ -8,14 +8,28 @@ lb lb\ l li .\ File type\tPrograms -# Substitute '-' with '\-' -:a -s/\(\t.*[^\\]\)-/\1\\-/ -ta - # Format rows -s/\t/&T{\n/; s/$/\nT}/ +/^$/! { + # Remove links + :a + s/\[\(\S*\)\]\[\S*\]/\1/ + ta + + # Substitute '-' with '\-' + :b + s/\(\t.*[^\\]\)-/\1\\-/ + tb + + # Add data block to enable line wrapping + s/\t/&T{\n/; s/$/\nT}/ +} # Add footer $a\ .TE + +# Delete links +/^>/d + +# Delete empty lines +/^$/d