app

package
v0.0.0-...-9a83fbb Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRun

func NewRun(r RunFunc) runFunInfo

Types

type App

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

func (App) Run

func (app App) Run()

type AppBuilder

type AppBuilder struct {
	Context    *AppContext
	CmdBuilder *CommandBuilder
}

func NewAppBuilder

func NewAppBuilder() *AppBuilder

func (*AppBuilder) BindOptions

func (a *AppBuilder) BindOptions(key string, options interface{})

func (*AppBuilder) Build

func (ab *AppBuilder) Build() (*App, error)

func (*AppBuilder) ConfigureServices

func (a *AppBuilder) ConfigureServices(action RunFunc)

func (*AppBuilder) Info

func (ab *AppBuilder) Info(use string, short string, description string) *AppBuilder

func (*AppBuilder) OrderPostRun

func (a *AppBuilder) OrderPostRun(order int, action RunFunc)

func (*AppBuilder) OrderPreRun

func (a *AppBuilder) OrderPreRun(order int, action RunFunc)

func (*AppBuilder) OrderRun

func (a *AppBuilder) OrderRun(order int, action RunFunc)

func (*AppBuilder) PostRun

func (a *AppBuilder) PostRun(action RunFunc)

func (*AppBuilder) PreRun

func (a *AppBuilder) PreRun(action RunFunc)

func (*AppBuilder) Run

func (a *AppBuilder) Run(action RunFunc)

func (*AppBuilder) Use

func (a *AppBuilder) Use(action func(*AppBuilder)) *AppBuilder

func (*AppBuilder) Version

func (ab *AppBuilder) Version(version string) *AppBuilder

type AppContext

type AppContext struct {
	PreRuns  []runFunInfo
	Runs     []runFunInfo
	PostRuns []runFunInfo

	Name        string
	Short       string
	Description string
	Version     string
}

func NewAppContext

func NewAppContext() *AppContext

func (*AppContext) OrderRun

func (a *AppContext) OrderRun(order int, action RunFunc)

func (*AppContext) PostOrderRun

func (a *AppContext) PostOrderRun(order int, action RunFunc)

func (*AppContext) PostRun

func (a *AppContext) PostRun(action RunFunc)

func (*AppContext) PreOrderRun

func (a *AppContext) PreOrderRun(order int, action RunFunc)

func (*AppContext) PreRun

func (a *AppContext) PreRun(action RunFunc)

func (*AppContext) Run

func (a *AppContext) Run(action RunFunc)

type CommandBuilder

type CommandBuilder struct {
	RootCmd *cobra.Command
}

func NewCommandBuilder

func NewCommandBuilder() *CommandBuilder

func (*CommandBuilder) AddCommand

func (b *CommandBuilder) AddCommand(cmd *cobra.Command)

func (*CommandBuilder) AddRun

func (b *CommandBuilder) AddRun(use string, short string, run func())

func (*CommandBuilder) Build

func (cb *CommandBuilder) Build(ac *AppContext) (*cobra.Command, error)

type ConfigureFunc

type ConfigureFunc = func() error

type RunFunc

type RunFunc = func() error

type VersionInfo

type VersionInfo struct {
	Version string
	Date    string
	Commit  string
	BuiltBy string
}

func (*VersionInfo) String

func (v *VersionInfo) String() string

Jump to

Keyboard shortcuts

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