From 5863040f9323e210df0908333c6e85d63af000c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Mon, 26 Sep 2022 12:39:26 +0200 Subject: Update documentation, clean up --- xS/xS-gen-replies.awk | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'xS/xS-gen-replies.awk') diff --git a/xS/xS-gen-replies.awk b/xS/xS-gen-replies.awk index fce7b50..94a338f 100755 --- a/xS/xS-gen-replies.awk +++ b/xS/xS-gen-replies.awk @@ -1,15 +1,19 @@ #!/usr/bin/awk -f /^[0-9]+ *(ERR|RPL)_[A-Z]+ *".*"$/ { - match($0, /".*"/); - ids[$1] = $2; - texts[$2] = substr($0, RSTART, RLENGTH); + match($0, /".*"/) + ids[$1] = $2 + texts[$2] = substr($0, RSTART, RLENGTH) } END { - print "package " ENVIRON["GOPACKAGE"] "\n\nconst (" + print "package main" + print "" + print "const (" for (i in ids) printf("\t%s = %s\n", ids[i], i) - print ")\n\nvar defaultReplies = map[int]string{" + print ")" + print "" + print "var defaultReplies = map[int]string{" for (i in ids) print "\t" ids[i] ": " texts[ids[i]] "," print "}" -- cgit v1.2.3