| 171 | } |
| 172 | |
| 173 | func 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 | |
| 196 | func (terminalPrompts) ReadLine(prompt string) (string, error) { |
| 197 | rl, err := readline.NewEx(&readline.Config{Prompt: prompt}) |