MCPcopy Index your code
hub / github.com/cheat/cheat / parseCreatedConfPath

Function parseCreatedConfPath

test/integration/first_run_integration_test.go:208–221  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
208func 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().

Callers 1

TestFirstRunIntegrationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected