summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-08-24 19:58:13 +0200
committerMichał Górny <mgorny@gentoo.org>2019-08-24 19:58:13 +0200
commit62ba4e49e152f3f29e92b650eec6d06845bb1b86 (patch)
tree9ca1c4030d5027eca3539b950637986443ec32ab /bin
parentrepositories: Add menelkir (diff)
downloadapi-62ba4e49e152f3f29e92b650eec6d06845bb1b86.tar.gz
api-62ba4e49e152f3f29e92b650eec6d06845bb1b86.tar.bz2
api-62ba4e49e152f3f29e92b650eec6d06845bb1b86.zip
Add uid-gid.txt → wiki conversion script
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/uidgid2wiki.awk60
1 files changed, 60 insertions, 0 deletions
diff --git a/bin/uidgid2wiki.awk b/bin/uidgid2wiki.awk
new file mode 100755
index 0000000..3c3e22f
--- /dev/null
+++ b/bin/uidgid2wiki.awk
@@ -0,0 +1,60 @@
+#!/usr/bin/awk -f
+
+BEGIN {
+ print "{|class=\"wikitable sortable\""
+ print "! Name"
+ print "! data-sort-type=\"number\" | UID"
+ print "! data-sort-type=\"number\" | GID"
+ print "! Provider"
+ print "! class=unsortable | Notes"
+}
+
+function md2wiki(str) {
+ return gensub(/\[([^\]]+)\]\(([^)]+)\)/, "[\\2 \\1]", "g", str)
+}
+
+/^[^#]/ {
+ print "|-"
+ # name
+ print "| " $1
+ # uid
+ print "| " $2
+ # gid
+ print "| " $3
+ # provider
+ switch ($4) {
+ case "baselayout":
+ print "| style=\"background: #cff;\" | baselayout (linux)"
+ break
+ case "baselayout-fbsd":
+ print "| style=\"background: #ccf;\" | baselayout (fbsd)"
+ break
+ case "acct":
+ printf "%s", "| style=\"background: #9fc;\" |"
+ if ($2 != "-") printf " %s", "[https://gitweb.gentoo.org/repo/gentoo.git/tree/acct-user/" $1 " u:" $1 "]"
+ if ($3 != "-") printf " %s", "[https://gitweb.gentoo.org/repo/gentoo.git/tree/acct-group/" $1 " g:" $1 "]"
+ print ""
+ break
+ case "requested":
+ print "| style=\"background: #ffe;\" | requested"
+ break
+ case "reserved":
+ print "| style=\"background: #fcf;\" | reserved"
+ break
+ case "user.eclass":
+ print "| style=\"background: #dca;\" | user.eclass"
+ break
+ case "historical":
+ print "| style=\"background: #fee;\" | historical"
+ break
+ default:
+ print "| " $4
+ }
+ # notes
+ $1=$2=$3=$4=""
+ print "| " md2wiki(substr($0, 5))
+}
+
+END {
+ print "|}"
+}