commit: 62ba4e49e152f3f29e92b650eec6d06845bb1b86
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 24 17:58:13 2019 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 24 17:58:13 2019 +0000
URL: https://gitweb.gentoo.org/data/api.git/commit/?id=62ba4e49
Add uid-gid.txt → wiki conversion script
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
bin/uidgid2wiki.awk | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
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 "|}"
+}