()
| 407 | } |
| 408 | |
| 409 | func 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 | |
| 432 | func resolveIDPrefix(cmd *cobra.Command, isTTY bool) (string, error) { |
| 433 | if cmd.Flags().Changed("id-prefix") { |
no outgoing calls
no test coverage detected