summarylogtreecommitdiffstats
path: root/optlist.awk
blob: d03e70e0641bcdbb5c3c145867c4ac1f219a567d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/gawk -f

@include "join"

BEGIN {
  len = 0

  extra["chafa"] = " on Wayland"
  extra["ueberzug"] = " on X11"
}

BEGINFILE {
  line = 0
}

line == 0 {
  type = $0
}

line == 1 {
  sub(/.*\//, "")
  package = $0
  package_type[package][++package_type_len[package]] = type
}

{
  line++
}

ENDFILE {
  len++
}

END {
    for (package in package_type) {
        types = join(package_type[package], 1, package_type_len[package], ", ")
        printf "    '%s: for %s files%s'\n", package, types, extra[package]
    }
}