summaryrefslogtreecommitdiff
path: root/sd_messages/messages.go.gen
diff options
context:
space:
mode:
Diffstat (limited to 'sd_messages/messages.go.gen')
-rwxr-xr-xsd_messages/messages.go.gen48
1 files changed, 35 insertions, 13 deletions
diff --git a/sd_messages/messages.go.gen b/sd_messages/messages.go.gen
index 423829b..3314df3 100755
--- a/sd_messages/messages.go.gen
+++ b/sd_messages/messages.go.gen
@@ -1,17 +1,39 @@
-#!/usr/bin/sed -rnf
-1apackage foo
-1aconst (
-/^#define\s+SD_MESSAGE_/ {
+#!/usr/bin/env bash
+# Copyright (C) 2017 Luke Shumaker <lukeshu@sbcglobal.net>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
- s/^#define\s+SD_MESSAGE_(\S*)/\1 =/
+{
+ printf '//'
+ printf ' %q' "$0" "$@"
+ printf '\n// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT\n\n'
+ sed -rn '
+ 1apackage sd_messages
+ 1aimport "git.lukeshu.com/go/libsystemd/sd_id128"
+ 1avar (
+ /^#define\s+SD_MESSAGE_/ {
- s/SD_ID128_MAKE\(/ID128{0x/
- s/,/,0x/g
- s/\)/}/
+ s/^#define\s+SD_MESSAGE_(\S*)/\1 =/
- s/(^|_)([A-Z])([A-Z]*)/\U\2\L\3/g
+ s/SD_ID128_MAKE\(/sd_id128.ID128{0x/
+ s/,/,0x/g
+ s/\)/}/
- p
-}
-/^$/p
-$a)
+ s/(^|_)([A-Z])([A-Z]*)/\U\2\L\3/g
+
+ p
+ }
+ /^$/p
+ $a)
+ ' "$@"
+} | gofmt