Documentation ¶
Index ¶
- Variables
- func Register(m Module)
- type AppEnv
- type Application
- func (a *Application) Getenv(key string) string
- func (a *Application) Print(args ...interface{}) (n int, err error)
- func (a *Application) PrintModuleHelp(m Module)
- func (a *Application) Printf(format string, args ...interface{}) (n int, err error)
- func (a *Application) Println(args ...interface{}) (n int, err error)
- func (a *Application) Run()
- func (a *Application) Setenv(key string, value string) error
- func (a *Application) ShowIntro() error
- type ApplicationConfig
- type BasicModule
- func (m *BasicModule) Cmd() string
- func (m *BasicModule) Desc(a *Application) string
- func (m *BasicModule) Exec(a *Application, args []string) error
- func (m *BasicModule) FlagSet() *flag.FlagSet
- func (m *BasicModule) Group(a *Application) string
- func (m *BasicModule) Help(a *Application) string
- func (m *BasicModule) ID() string
- func (m *BasicModule) Reset()
- type Module
- type Modules
- type PrefixEnv
- type PresetEnv
Constants ¶
This section is empty.
Variables ¶
View Source
var HelpModuleCmd = "help"
View Source
var OsEnv = NewPrefixEnv("")
View Source
var RegisteredModules = NewModules()
Functions ¶
Types ¶
type Application ¶
type Application struct { Config *ApplicationConfig Args []string Env AppEnv Cwd string Modules *Modules Stdout io.Writer Stdin io.Reader FlagDefaults string HelpModuleCmd string }
func NewApplication ¶
func NewApplication(config *ApplicationConfig) *Application
func (*Application) Getenv ¶
func (a *Application) Getenv(key string) string
func (*Application) Print ¶
func (a *Application) Print(args ...interface{}) (n int, err error)
func (*Application) PrintModuleHelp ¶
func (a *Application) PrintModuleHelp(m Module)
func (*Application) Printf ¶
func (a *Application) Printf(format string, args ...interface{}) (n int, err error)
func (*Application) Println ¶
func (a *Application) Println(args ...interface{}) (n int, err error)
func (*Application) Run ¶
func (a *Application) Run()
func (*Application) ShowIntro ¶
func (a *Application) ShowIntro() error
type ApplicationConfig ¶
func NewApplicationConfig ¶
func NewApplicationConfig() *ApplicationConfig
type BasicModule ¶
type BasicModule struct {
// contains filtered or unexported fields
}
func (*BasicModule) Cmd ¶
func (m *BasicModule) Cmd() string
func (*BasicModule) Desc ¶
func (m *BasicModule) Desc(a *Application) string
func (*BasicModule) Exec ¶
func (m *BasicModule) Exec(a *Application, args []string) error
func (*BasicModule) FlagSet ¶
func (m *BasicModule) FlagSet() *flag.FlagSet
func (*BasicModule) Group ¶
func (m *BasicModule) Group(a *Application) string
func (*BasicModule) Help ¶
func (m *BasicModule) Help(a *Application) string
func (*BasicModule) ID ¶
func (m *BasicModule) ID() string
func (*BasicModule) Reset ¶
func (m *BasicModule) Reset()
type Module ¶
type Module interface { ID() string Cmd() string Help(a *Application) string Desc(a *Application) string Group(a *Application) string FlagSet() *flag.FlagSet Exec(a *Application, args []string) error }
Click to show internal directories.
Click to hide internal directories.