MCPcopy Index your code
hub / github.com/jetify-com/devbox / setPackageBool

Method setPackageBool

internal/devconfig/configfile/ast.go:176–194  ·  view source on GitHub ↗

setPackageBool sets a bool field on a package.

(name, fieldName string, val bool)

Source from the content-addressed store, hash-verified

174
175// setPackageBool sets a bool field on a package.
176func (c *configAST) setPackageBool(name, fieldName string, val bool) {
177 pkgObject := c.findPkgObject(name)
178 if pkgObject == nil {
179 return
180 }
181 if i := c.memberIndex(pkgObject, fieldName); i == -1 {
182 pkgObject.Members = append(pkgObject.Members, hujson.ObjectMember{
183 Name: hujson.Value{
184 Value: hujson.String(fieldName),
185 BeforeExtra: []byte{'\n'},
186 },
187 Value: hujson.Value{Value: hujson.Bool(val)},
188 })
189 } else {
190 pkgObject.Members[i].Value.Value = hujson.Bool(val)
191 }
192
193 c.root.Format()
194}
195
196func (c *configAST) appendPlatforms(name, fieldName string, platforms []string) {
197 if len(platforms) == 0 {

Callers 1

SetDisablePluginMethod · 0.80

Calls 4

findPkgObjectMethod · 0.95
memberIndexMethod · 0.95
StringMethod · 0.45
FormatMethod · 0.45

Tested by

no test coverage detected