MCPcopy
hub / github.com/larksuite/cli / validateBindFlags

Function validateBindFlags

cmd/config/bind.go:624–638  ·  view source on GitHub ↗

validateBindFlags validates enum flags early, before any side effects.

(opts *BindOptions)

Source from the content-addressed store, hash-verified

622
623// validateBindFlags validates enum flags early, before any side effects.
624func 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

Callers 1

configBindRunFunction · 0.85

Calls 3

NewValidationErrorFunction · 0.92
ParseLangFlagFunction · 0.92
WithParamMethod · 0.80

Tested by

no test coverage detected