From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1107369-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id DCF95138334
	for <garchives@archives.gentoo.org>; Sat, 24 Aug 2019 17:58:35 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 0FE4AE0809;
	Sat, 24 Aug 2019 17:58:35 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id EEE89E0809
	for <gentoo-commits@lists.gentoo.org>; Sat, 24 Aug 2019 17:58:34 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 067CB34A244
	for <gentoo-commits@lists.gentoo.org>; Sat, 24 Aug 2019 17:58:34 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id BB60F6D5
	for <gentoo-commits@lists.gentoo.org>; Sat, 24 Aug 2019 17:58:31 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1566669493.62ba4e49e152f3f29e92b650eec6d06845bb1b86.mgorny@gentoo>
Subject: [gentoo-commits] data/api:master commit in: bin/
X-VCS-Repository: data/api
X-VCS-Files: bin/uidgid2wiki.awk
X-VCS-Directories: bin/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: 62ba4e49e152f3f29e92b650eec6d06845bb1b86
X-VCS-Branch: master
Date: Sat, 24 Aug 2019 17:58:31 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: c03c5273-6c1f-46b7-afc6-ecf8d29b0928
X-Archives-Hash: a4728253053686671741853574c29d6d

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 "|}"
+}