aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorrtz12 <koenig@fagott.pw>2016-10-11 18:53:22 (UTC)
committerrtz12 <koenig@fagott.pw>2016-10-11 18:53:22 (UTC)
commitfbd746aef8c78067593f901afb0f255574392499 (patch)
tree10b91eabfc5696d5e0fe27f1649bd72b9ed461e5 /bin
parentbf51b2e4a035a988b9e9cef737966846c619dace (diff)
NSA implementiert
Diffstat (limited to 'bin')
-rwxr-xr-xbin/generate-events38
1 files changed, 38 insertions, 0 deletions
diff --git a/bin/generate-events b/bin/generate-events
new file mode 100755
index 0000000..c4a0c1c
--- /dev/null
+++ b/bin/generate-events
@@ -0,0 +1,38 @@
1#!/bin/bash
2events=$(cat)
3echo 'package eventlogging
4/*
5 * THIS FILE IS AUTOGENERATED
6 * DO NOT EDIT MANUALLY!!!
7 */
8
9import (
10 "fagott.pw/charakterin"
11)
12
13'
14
15echo "var Events = []string{"
16while read event
17do
18 cat <<EOT
19 "$event",
20EOT
21done <<<"$events"
22echo '}
23'
24
25while read event
26do
27 funcName=$(sed -r 's/(^|_)(.)([^_]*)/\2\L\3/g' <<<$event)
28 cat <<EOT
29func (l *EventLogger) ${funcName}(user *charakterin.User, data ${funcName}Data) {
30 if user != nil {
31 data.User = user.Name
32 data.UserAgent = user.Agent
33 }
34 l.base.Log("$event", data)
35}
36
37EOT
38done <<<"$events"