diff --git a/prompts/sources.go b/prompts/sources.go index 2c099f998..7632d52f2 100644 --- a/prompts/sources.go +++ b/prompts/sources.go @@ -31,15 +31,13 @@ func getBaseSourcePrompts(currentWorkflow *workflow.Workflow, sourceName, fileLo ) } - if fileLocation == nil || *fileLocation == "" { - initialGroup = append(initialGroup, - charm_internal.NewInput(). - Title("What is the location of your OpenAPI document?"). - Placeholder("local file path or remote file reference."). - Value(fileLocation). - Suggestions(schemaFilesInCurrentDir()), - ) - } + initialGroup = append(initialGroup, + charm_internal.NewInput(). + Title("What is the location of your OpenAPI document?"). + Placeholder("local file path or remote file reference."). + Value(fileLocation). + Suggestions(schemaFilesInCurrentDir()), + ) var groups []*huh.Group @@ -120,6 +118,10 @@ func sourceBaseForm(quickstart *Quickstart) (*QuickstartState, error) { fileLocation = *quickstart.Defaults.SchemaPath } + if suggestions := schemaFilesInCurrentDir(); len(suggestions) > 0 { + fileLocation = suggestions[0] + } + if _, err := tea.NewProgram(charm_internal.NewForm(huh.NewForm( getBaseSourcePrompts(quickstart.WorkflowFile, &sourceName, &fileLocation, &authHeader, &authSecret)...), "Let's setup a new source for your workflow.",