File tree 1 file changed +43
-0
lines changed
1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -eo pipefail
4
+
5
+ function echo_name () {
6
+ cat << _EOF_
7
+ /******************************************************************
8
+ * Proto File: $1
9
+ ******************************************************************/
10
+ _EOF_
11
+ }
12
+
13
+ function strip_header () {
14
+ sed -r ' /^(syntax|package|import)/s/.*//'
15
+ }
16
+
17
+ function strip_package () {
18
+ # (base.
19
+ # (stream event.
20
+ sed -r ' s/ \(\w+\./ \(/g' \
21
+ | sed -r ' s/ \(stream \w+\./ \(stream /'
22
+ }
23
+
24
+ function main () {
25
+ cat << '_EOF_ '
26
+ syntax = "proto3";
27
+ import "google/protobuf/wrappers.proto";
28
+ package wechaty.puppet;
29
+ _EOF_
30
+
31
+ for file in proto/wechaty/puppet/* .proto; do
32
+ echo_name " $file "
33
+ cat " $file " | strip_header
34
+ done
35
+
36
+ file=' proto/wechaty/puppet.proto'
37
+ echo_name " $file "
38
+ cat " $file " \
39
+ | strip_header \
40
+ | strip_package
41
+ }
42
+
43
+ main
You can’t perform that action at this time.
0 commit comments