command

package
v0.0.0-...-ae29a83 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAlias

func WithAlias(alias []string) commandOption

WithAlias sets command aliases

func WithFlags

func WithFlags(flags cli.Flag) commandOption

WithFlags add command flags

Types

type CommandBuilder

type CommandBuilder[T any] struct {
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand[T any](name, usage string, defaultConfig T, options ...commandOption) *CommandBuilder[T]

func (*CommandBuilder[T]) AddHandler

func (cb *CommandBuilder[T]) AddHandler(h CommandHandler[T]) *CommandBuilder[T]

AddHandler add command handler

func (*CommandBuilder[T]) Create

func (cb *CommandBuilder[T]) Create() *cli.Command

Create construct command and output as cli.Command

type CommandHandler

type CommandHandler[T any] interface {
	Handle(c *cli.Context, cfg T) error
}

type InlineHandler

type InlineHandler[T any] func(c *cli.Context, cfg T) error

func (InlineHandler[T]) Handle

func (s InlineHandler[T]) Handle(c *cli.Context, cfg T) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL