MCPcopy Create free account
hub / github.com/52funny/pikpakcli / setMappingValue

Function setMappingValue

cli/setup/setup.go:173–194  ·  view source on GitHub ↗
(node *yaml.Node, path []string, value string)

Source from the content-addressed store, hash-verified

171}
172
173func setMappingValue(node *yaml.Node, path []string, value string) bool {
174 if node.Kind == yaml.DocumentNode && len(node.Content) > 0 {
175 return setMappingValue(node.Content[0], path, value)
176 }
177 if node.Kind != yaml.MappingNode || len(path) == 0 {
178 return false
179 }
180 for i := 0; i < len(node.Content)-1; i += 2 {
181 if node.Content[i].Value != path[0] {
182 continue
183 }
184 if len(path) == 1 {
185 node.Content[i+1].Kind = yaml.ScalarNode
186 node.Content[i+1].Tag = "!!str"
187 node.Content[i+1].Value = value
188 node.Content[i+1].Style = 0
189 return true
190 }
191 return setMappingValue(node.Content[i+1], path[1:], value)
192 }
193 return false
194}
195
196func (terminalPrompts) ReadLine(prompt string) (string, error) {
197 rl, err := readline.NewEx(&readline.Config{Prompt: prompt})

Callers 1

buildConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected