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

Function resolveIDPrefix

apps/cli/internal/cli/project_init.go:432–455  ·  view source on GitHub ↗
(cmd *cobra.Command, isTTY bool)

Source from the content-addressed store, hash-verified

430}
431
432func resolveIDPrefix(cmd *cobra.Command, isTTY bool) (string, error) {
433 if cmd.Flags().Changed("id-prefix") {
434 if projectInitIDPrefix == "" {
435 return "", fmt.Errorf("--id-prefix cannot be empty for prefixed strategy")
436 }
437 return projectInitIDPrefix, nil
438 }
439 if isTTY {
440 value := ""
441 err := huh.NewInput().
442 Title("ID prefix").
443 Description("Short prefix for task IDs (e.g., \"dr\", \"cli\")").
444 Value(&value).
445 Run()
446 if err != nil {
447 return "", fmt.Errorf("prompt cancelled: %w", err)
448 }
449 if value == "" {
450 return "", fmt.Errorf("prefix cannot be empty for prefixed strategy")
451 }
452 return value, nil
453 }
454 return "", fmt.Errorf("--id-prefix is required for prefixed strategy in non-interactive mode")
455}
456
457// idStrategyExamples holds strategy-specific placeholder replacements.
458type idStrategyExamples struct {

Callers 1

resolveInitIDStrategyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected