app

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBaseName

func FormatBaseName(basename string) string

func PrintSections

func PrintSections(w io.Writer, fss FlagSets, cols int)

Types

type App

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

func NewApp

func NewApp(name string, basename string, opts ...Option) *App

func (*App) Run

func (a *App) Run()

type CliOptions

type CliOptions interface {
	Flags() (fss FlagSets)
	Validate() []error
}

type Command

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

func NewCommand

func NewCommand(usage string, desc string, opts ...CommandOption) *Command

func (*Command) AddCommand

func (c *Command) AddCommand(cmd *Command)

type CommandOption

type CommandOption func(*Command)

func WithCommandOptions

func WithCommandOptions(opt CliOptions) CommandOption

func WithCommandRunFunc

func WithCommandRunFunc(run RunCommandFunc) CommandOption

type CompleteableOptions

type CompleteableOptions interface {
	Complete() error
}

type FlagSets

type FlagSets struct {
	Order []string
	Sets  map[string]*pflag.FlagSet
}

func (*FlagSets) FlagSet

func (fs *FlagSets) FlagSet(name string) *pflag.FlagSet

type Option

type Option func(app *App)

func WithDefaultValidArgs

func WithDefaultValidArgs() Option

func WithDescription

func WithDescription(desc string) Option

func WithNoConfig

func WithNoConfig() Option

func WithOptions

func WithOptions(opt CliOptions) Option

func WithRunFunc

func WithRunFunc(run RunFunc) Option

func WithValidArgs

func WithValidArgs(args cobra.PositionalArgs) Option

type RunCommandFunc

type RunCommandFunc func(args []string) error

type RunFunc

type RunFunc func(basename string) error

Jump to

Keyboard shortcuts

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