summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-29 21:36:58 -0500
committerJeff Carr <[email protected]>2025-03-29 21:36:58 -0500
commit41bac3da7badc42810e790797e621fb7a63408fa (patch)
tree33d71ac62e1aeab2ff862062da61df92b3852c7f
parent12b8c5603b682e4e4572c3412078c3319e2b4fe4 (diff)
more attempts
-rw-r--r--protoReformat.go28
1 files changed, 22 insertions, 6 deletions
diff --git a/protoReformat.go b/protoReformat.go
index f6fc96b..2732522 100644
--- a/protoReformat.go
+++ b/protoReformat.go
@@ -342,10 +342,12 @@ func formatEnum(curmsg *FormatMsg) []string {
if argv.Debug {
header := fmt.Sprintf("%s%s // enum2 depth=%d", curmsg.padBase(), curmsg.Header, curmsg.Depth)
newmsg = append(newmsg, header)
- header = fmt.Sprintf("//%s//%s// enum2 depth=%d", curmsg.padding(2), curmsg.Header, curmsg.Depth)
- newmsg = append(newmsg, header)
- header = fmt.Sprintf("// %s", curmsg.Header)
- newmsg = append(newmsg, header)
+ /*
+ header = fmt.Sprintf("//%s//%s// enum2 depth=%d", curmsg.padding(2), curmsg.Header, curmsg.Depth)
+ newmsg = append(newmsg, header)
+ header = fmt.Sprintf("// %s", curmsg.Header)
+ newmsg = append(newmsg, header)
+ */
} else {
header := fmt.Sprintf("%s%s", curmsg.padBase(), curmsg.Header)
newmsg = append(newmsg, header)
@@ -411,7 +413,16 @@ func formatMessage(curmsg *FormatMsg) []string {
var newmsg []string
// add the notes & comments before the header
- newmsg = append(newmsg, strings.TrimSpace(strings.Join(curmsg.Notes, "\n")))
+ // newmsg = append(newmsg, strings.TrimSpace(strings.Join(curmsg.Notes, "\n")))
+ for _, line := range strings.Split(strings.TrimSpace(strings.Join(curmsg.Notes, "\n")), "\n") {
+ if argv.Debug {
+ footer := fmt.Sprintf("%s%s // msg notes footer depth=%d", curmsg.padBase(), line, curmsg.Depth)
+ newmsg = append(newmsg, footer)
+ } else {
+ footer := fmt.Sprintf("%s%s", curmsg.padBase(), line)
+ newmsg = append(newmsg, footer)
+ }
+ }
if curmsg.Header != "" {
var line string
@@ -453,7 +464,12 @@ func formatMessage(curmsg *FormatMsg) []string {
case FormatMsg_ENUM:
for _, line := range formatEnum(msg) {
// line = fmt.Sprintf("%s%s", curmsg.pad(), line)
- newmsg = append(newmsg, line)
+ line = strings.TrimSpace(line)
+ if argv.Debug {
+ line = fmt.Sprintf("%s%s // msg depth=%d", msg.padBase(), line, msg.Depth)
+ } else {
+ line = fmt.Sprintf("%s%s", msg.padBase(), line)
+ }
}
case FormatMsg_MESSAGE:
for _, line := range msg.format() {