Docs: add links to programs

Resolves #71

Co-authored-by: ld991 <140622991+ld991@users.noreply.github.com>
This commit is contained in:
Nikita Ivanov 2023-08-26 14:10:53 +02:00
parent 95bfa3720b
commit bfed2488ad
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133
4 changed files with 111 additions and 29 deletions

View File

@ -43,23 +43,47 @@ For example, you only need either `elinks`, `lynx` or
<!--TABLESTART--> <!--TABLESTART-->
| File types | Programs | | File types | Programs |
| ---- | ---- | | ---- | ---- |
| any | `exiftool` `cat` | | any | [exiftool][exiftool] cat |
| archive | `atool` | | archive | [atool][atool] |
| audio | `ffmpegthumbnailer` `ffmpeg` | | audio | [ffmpegthumbnailer][ffmpegthumbnailer] [ffmpeg][ffmpeg] |
| diff | `colordiff` `delta` `diff-so-fancy` | | diff | [colordiff][colordiff] [delta][delta] [diff-so-fancy][diff-so-fancy] |
| directory | `ls` | | directory | ls |
| font | `fontimage` | | font | fontimage |
| gpg-encrypted | `gpg` | | gpg-encrypted | [gpg][gpg] |
| html | `elinks` `lynx` `w3m` | | html | [elinks][elinks] [lynx][lynx] [w3m][w3m] |
| image | `ueberzug` `chafa` | | image | [ueberzug][ueberzug] [chafa][chafa] |
| json | `jq` | | json | [jq][jq] |
| markdown | `glow` `mdcat` | | markdown | [glow][glow] [mdcat][mdcat] |
| office | `libreoffice` | | office | [libreoffice][libreoffice] |
| pdf | `pdftoppm` | | pdf | pdftoppm |
| svg | `convert` | | svg | convert |
| text | `bat` `cat` `highlight` `source-highlight` | | text | bat cat [highlight][highlight] [source-highlight][source-highlight] |
| torrent | `transmission-show` | | torrent | transmission-show |
| video | `ffmpegthumbnailer` | | 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/
<!--TABLEEND--> <!--TABLEEND-->

View File

@ -29,11 +29,36 @@ function process_file(file, i, line, arr, t, p, p_len) {
t = arr[1] t = arr[1]
p_len = split(arr[2], p, /\s+/) p_len = split(arr[2], p, /\s+/)
for (i = 1; i <= p_len; i++) for (i = 1; i <= p_len; i++) {
types[t][types_len[t]++] = p[i] types[t][types_len[t]++] = LINKS[p[i]] ? sprintf("[%s][%s]", p[i], p[i]) : p[i]
}
} }
BEGIN { 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++) for (i = 1; i < ARGC; i++)
process_file(ARGV[i]) process_file(ARGV[i])
@ -41,4 +66,12 @@ BEGIN {
s = s sprintf("%s\t%s\n", t, join(types[t], " ")) s = s sprintf("%s\t%s\n", t, join(types[t], " "))
printf "%s", s | "sort" printf "%s", s | "sort"
close("sort")
print ""
for (k in LINKS) {
if (!LINKS[k])
continue
printf ">\t%s\t%s\n", k, LINKS[k]
}
} }

View File

@ -5,11 +5,22 @@
| File types | Programs |\ | File types | Programs |\
| ---- | ---- | | ---- | ---- |
# Format links
/^>/ {
s/>\t/[/
s/\t/]: /
be
}
# Format rows # Format rows
s/ /` `/g /^$/! {
s/\t/ | `/ s/ / /g
s/\t/ | /
s/^/| / s/^/| /
s/$/` |/ s/$/ |/
}
:e
# Add a newline at the end # Add a newline at the end
$a\ $a\

View File

@ -8,14 +8,28 @@ lb lb\
l li .\ l li .\
File type\tPrograms File type\tPrograms
# Substitute '-' with '\-' # Format rows
/^$/! {
# Remove links
:a :a
s/\(\t.*[^\\]\)-/\1\\-/ s/\[\(\S*\)\]\[\S*\]/\1/
ta ta
# Format rows # Substitute '-' with '\-'
:b
s/\(\t.*[^\\]\)-/\1\\-/
tb
# Add data block to enable line wrapping
s/\t/&T{\n/; s/$/\nT}/ s/\t/&T{\n/; s/$/\nT}/
}
# Add footer # Add footer
$a\ $a\
.TE .TE
# Delete links
/^>/d
# Delete empty lines
/^$/d