validateBindFlags validates enum flags early, before any side effects.
(opts *BindOptions)
| 622 | |
| 623 | // validateBindFlags validates enum flags early, before any side effects. |
| 624 | func validateBindFlags(opts *BindOptions) error { |
| 625 | if opts.Identity != "" { |
| 626 | switch opts.Identity { |
| 627 | case "bot-only", "user-default": |
| 628 | default: |
| 629 | return errs.NewValidationError(errs.SubtypeInvalidArgument, "invalid --identity %q; valid values: bot-only, user-default", opts.Identity).WithParam("--identity") |
| 630 | } |
| 631 | } |
| 632 | lang, err := cmdutil.ParseLangFlag(opts.Lang) |
| 633 | if err != nil { |
| 634 | return err |
| 635 | } |
| 636 | opts.Lang = string(lang) |
| 637 | return nil |
| 638 | } |
| 639 | |
| 640 | // tuiSelectIdentity prompts user to pick one of two identity presets. |
| 641 | // bot-only is listed first so Enter on the default highlight maps to the |
no test coverage detected