func (m *module) AddBool(name string, value bool) {
	m.group.AddBool(name, value)
}
Add a boolean property as a top level module property
package bpwriter
import (
	"fmt"
	"sort"
	"strings"
	"sync"
	"github.com/ARM-software/bob-build/internal/utils"
)
func indentString(depth int) string {
	return strings.Repeat(" ", depth*4)
}
var bpEscaper = strings.NewReplacer("\"", "\\\"")
func Escape(s string) string {
	return bpEscaper.Replace(s)
}
func EscapeList(slice []string) []string {
	slice = append([]string(nil), slice...)
	for i, s := range slice {
		slice[i] = Escape(s)
	}
	return slice
}
type property struct {
	key string
	value string
}
type Group interface {
	AddString(name, value string)
	AddBool(name string, value bool)
	AddOptionalBool(name string, value *bool)
	AddStringList(name string, list []string)
	AddStringCmd(name string, argLists ...[]string)
	NewGroup(name string) Group
}
type group struct {
	name string
	depth int
	props []property
	groups []*group
}
var _ Group = (*group)(nil)
func (g *group) addProp(key, value string) {
	p := property{
		key:   key,
		value: value,
	}
	g.props = append(g.props, p)
}
func (g *group) AddString(name, value string) {
	g.addProp(name, "\""+Escape(value)+"\"")
}
func (g *group) AddBool(name string, value bool) {
	if value {
		g.addProp(name, "true")
	} else {
		g.addProp(name, "false")
	}
}
func (g *group) AddOptionalBool(name string, value *bool) {
	if value != nil {
		g.AddBool(name, *value)
	}
}
func (g *group) AddStringList(name string, list []string) {
	if len(list) == 0 {
		return
	}
	s := ""
	if len(list) > 1 {
		s += "[\n"
		indent := indentString(g.depth + 1)
		for _, v := range list {
			s += indent + "\"" + Escape(v) + "\",\n"
		}
		s += indentString(g.depth) + "]"
	} else {
		s += "[\"" + Escape(list[0]) + "\"]"
	}
	g.addProp(name, s)
}
func (g *group) AddStringCmd(name string, argLists ...[]string) {
	g.AddString(name, utils.Join(argLists...))
}
func (g *group) NewGroup(name string) Group {
	g0 := group{}
	g0.name = name
	g0.depth = g.depth + 1
	g.groups = append(g.groups, &g0)
	return &g0
}
func (g *group) render(b *strings.Builder) {
	indent := indentString(g.depth)
	for _, p := range g.props {
		b.WriteString(indent + p.key + ": " + p.value + ",\n")
	}
	for _, group := range g.groups {
		b.WriteString(indent + group.name + ": {\n")
		group.render(b)
		b.WriteString(indent + "},\n")
	}
}
type Module interface {
	Group
}
type module struct {
	modType string
	name string
	group
}
var _ Module = (*module)(nil)
func (m *module) AddString(name, value string) {
	m.group.AddString(name, value)
}