package main import ( "fmt" "net/netip" "strings" ) func (s *subnetResult) pretty(verb, indent int, sep, indentStr string, isRemaining, plain bool) (out string) { var pfx netip.Prefix var bullet string = "+" var sb *strings.Builder = new(strings.Builder) var pre string = strings.Repeat(indentStr, indent) var pre2 string = strings.Repeat(indentStr, indent+1) var fmts []string = sectFmts[plain] // var sectSep1 string = fmts[0] var sectSep2 string = fmts[1] var sectSep3 string = fmts[2] if s == nil { return } pfx = netip.Prefix(*s) if verb < 0 { verb = -1 } if isRemaining { bullet = "-" } if verb <= 0 { sb.WriteString(pfx.String() + sep) out = sb.String() return } else { sb.WriteString(pre + sectSep2 + "\n") sb.WriteString( printMask( fmt.Sprintf("%s %s", bullet, pfx.String()), pfx, verb, indent, indentStr, ), ) sb.WriteString(pre2 + sectSep3 + "\n") sb.WriteString(printHostPrefix("Network", &pfx, verb, 2, "\t")) sb.WriteString(pre + sectSep2 + "\n") } out = sb.String() return }