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

Function promptIDStrategy

apps/cli/internal/cli/project_init.go:409–430  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407}
408
409func promptIDStrategy() (string, error) {
410 options := []huh.Option[string]{
411 huh.NewOption("Sequential (001, 002, ...)", "sequential").Selected(true),
412 huh.NewOption("Prefixed (dr-001, dr-002, ...)", "prefixed"),
413 huh.NewOption("Random (a3f9x2, b7k2m1, ...)", "random"),
414 huh.NewOption("ULID (01h5a3mpk, ...)", "ulid"),
415 }
416
417 var selected string
418 err := huh.NewSelect[string]().
419 Title("ID strategy").
420 Options(options...).
421 Value(&selected).
422 Run()
423 if err != nil {
424 return "sequential", fmt.Errorf("prompt cancelled: %w", err)
425 }
426 if selected == "" {
427 return "sequential", nil
428 }
429 return selected, nil
430}
431
432func resolveIDPrefix(cmd *cobra.Command, isTTY bool) (string, error) {
433 if cmd.Flags().Changed("id-prefix") {

Callers 1

resolveInitIDStrategyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected