Documentation
¶
Index ¶
- Variables
- func DecorateTemplate(ctx context.Context, root *cobra.Command, cfg *DecorateOptions) (string, error)
- func FlagsFor(str string, m FMap[Method]) (*pflag.FlagSet, error)
- func FormatCommandError(cmd *cobra.Command, err error) string
- func HandleErrorByPrintingToConsole(cmd *cobra.Command, err error) error
- func IsHandledByPrintingToConsole(err error) bool
- func NewSnake(opts *NewSnakeOpts) (*cobra.Command, error)
- func NewWrappedEnum[I ~string](values ...I) *wrappedEnum[I]
- type Cobrad
- type DecorateOptions
- type ErrHandledByPrintingToConsole
- type FMap
- type Flagged
- type HasRunArgs
- type IsRunnable
- type Method
- type NewSnakeOpts
- type Snake
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidMethodSignature = errors.New("invalid method signatured")
)
View Source
var (
ErrMissingResolver = errors.New("missing resolver")
)
Functions ¶
func DecorateTemplate ¶ added in v0.10.4
func DecorateTemplate(ctx context.Context, root *cobra.Command, cfg *DecorateOptions) (string, error)
Init patches Cobra's usage template with configuration provided.
func FormatCommandError ¶ added in v0.15.1
func HandleErrorByPrintingToConsole ¶ added in v0.8.1
func IsHandledByPrintingToConsole ¶ added in v0.8.1
func NewWrappedEnum ¶ added in v0.12.0
func NewWrappedEnum[I ~string](values ...I) *wrappedEnum[I]
Types ¶
type DecorateOptions ¶ added in v0.4.0
type ErrHandledByPrintingToConsole ¶ added in v0.8.1
type ErrHandledByPrintingToConsole struct {
// contains filtered or unexported fields
}
func (*ErrHandledByPrintingToConsole) Error ¶ added in v0.8.1
func (e *ErrHandledByPrintingToConsole) Error() string
func (*ErrHandledByPrintingToConsole) Unwrap ¶ added in v0.8.1
func (e *ErrHandledByPrintingToConsole) Unwrap() error
type HasRunArgs ¶ added in v0.12.0
type IsRunnable ¶ added in v0.12.0
type Method ¶ added in v0.12.0
type Method interface {
Flags(*pflag.FlagSet)
Run() reflect.Value
RunArgs() []reflect.Type
ReturnArgs() []reflect.Type
ValidateResponse() error
HandleResponse([]reflect.Value) (*reflect.Value, error)
Name() string
Command() Cobrad
IsContextResolver() bool
}
func NewArgumentMethod ¶ added in v0.13.0
func NewCommandMethod ¶ added in v0.13.0
type NewSnakeOpts ¶ added in v0.13.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.