MCPcopy Create free account
hub / github.com/driangle/taskmd / wizardSelectSource

Function wizardSelectSource

apps/cli/internal/cli/importcmd.go:261–282  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

259}
260
261func wizardSelectSource() (string, error) {
262 names := sync.RegisteredNames()
263 if len(names) == 0 {
264 return "", fmt.Errorf("no sources registered")
265 }
266
267 options := make([]huh.Option[string], len(names))
268 for i, n := range names {
269 options[i] = huh.NewOption(n, n)
270 }
271
272 var sourceName string
273 err := huh.NewSelect[string]().
274 Title("Where are your tasks?").
275 Options(options...).
276 Value(&sourceName).
277 Run()
278 if err != nil {
279 return "", fmt.Errorf("wizard cancelled: %w", err)
280 }
281 return sourceName, nil
282}
283
284func wizardSourceConfig(sourceName string) (sync.SourceConfig, error) {
285 cfg := sync.SourceConfig{Name: sourceName}

Callers 1

runImportWizardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected