command

package
v0.4.11 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Annotation added in v0.3.0

func Annotation(key, value string) opt.Option[Command]

func Annotations added in v0.3.0

func Annotations(annotations map[string]string) opt.Option[Command]

func BoolFlag added in v0.4.8

func BoolFlag(flag Flag, ptr *bool) opt.Option[Command]

func Deprecated added in v0.3.0

func Deprecated(reason ...string) opt.Option[Command]

func Example added in v0.3.0

func Example(example string) opt.Option[Command]

func IntFlag added in v0.4.8

func IntFlag(flag Flag, ptr *int) opt.Option[Command]

func Module

func Module() module.Module

func Runner added in v0.3.0

func Runner(impl func(cmd *cobra.Command, args []string) error) opt.Option[Command]

func StringFlag added in v0.3.0

func StringFlag(flag Flag, ptr *string) opt.Option[Command]

func SuggestFor added in v0.3.0

func SuggestFor(alternatives ...string) opt.Option[Command]

Types

type Command

type Command struct {
	Name                   string
	Short                  string
	Long                   string
	Run                    func(cmd *cobra.Command, args []string) error
	Example                string
	Annotations            map[string]string
	Deprecated             string
	SuggestFor             []string
	MutuallyExclusiveFlags []string
	RequiredOneFlags       []string
	RequiredFlags          []string
	FlagHandlers           map[string]func(cmd *cobra.Command) error
}

func New

func New(name string, short string, long string, opts ...opt.Option[Command]) *Command

type Flag added in v0.3.0

type Flag struct {
	Name        string
	Shorthand   string
	Usage       string
	OneRequired bool
	Required    bool
	Exclusive   bool
}

type Root

type Root struct {
	// contains filtered or unexported fields
}

func NewRoot

func NewRoot(params RootParams) *Root

func (*Root) OnStart

func (r *Root) OnStart(ctx context.Context) error

func (*Root) OnStop

func (r *Root) OnStop(context.Context) error

type RootParams

type RootParams struct {
	fx.In
	Manifest *manifest.Manifest
	Shutdown fx.Shutdowner
	Commands []*Command `group:"command"`
}

Jump to

Keyboard shortcuts

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