(cmd *cobra.Command, isTTY bool)
| 430 | } |
| 431 | |
| 432 | func 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. |
| 458 | type idStrategyExamples struct { |
no outgoing calls
no test coverage detected