parseCreatedConfPath extracts the config file path from the installer's "Created config file: " output. The message may appear mid-line (after prompt text), so we search for the substring anywhere in the output.
(t *testing.T, output string)
| 206 | // "Created config file: <path>" output. The message may appear mid-line |
| 207 | // (after prompt text), so we search for the substring anywhere in the output. |
| 208 | func parseCreatedConfPath(t *testing.T, output string) string { |
| 209 | t.Helper() |
| 210 | const marker = "Created config file: " |
| 211 | idx := strings.Index(output, marker) |
| 212 | if idx < 0 { |
| 213 | return "" |
| 214 | } |
| 215 | rest := output[idx+len(marker):] |
| 216 | // the path ends at the next newline |
| 217 | if nl := strings.IndexByte(rest, '\n'); nl >= 0 { |
| 218 | rest = rest[:nl] |
| 219 | } |
| 220 | return strings.TrimSpace(rest) |
| 221 | } |
| 222 | |
| 223 | // firstRunConfpaths returns the config file paths that cheat would check |
| 224 | // for the given home directory, matching the logic in config.Paths(). |
no outgoing calls
no test coverage detected