顶级函数
Package Level Functions...
cmdr 包级函数
- New/Create app
-
cmdr.New(opts ...cli.Opt) cli.App -
cmdr.Create(appName, version, author, desc string, opts ...cli.Opt) Creator -
Information
cmdr.App() cli.Runnercmdr.AppName() stringcmdr.AppVersion() stringcmdr.AppDescription() stringcmdr.AppDescriptionLong() stringcmdr.CmdLines() []string
-
- Errors
cmdr.Error() errors.Errorcmdr.Recycle(errs ...error)
- Parsing
cmdr.Parsed() boolcmdr.ParsedLastCmd() cli.Cmdcmdr.ParsedCommands() []cli.Cmdcmdr.ParsedPositionalArgs() []string
- Store
cmdr.Store(prefix ...string) store.Storecmdr.Set(prefix ...string) store.Storecmdr.LoadedSources() []cli.LoadedSources
- Utilities
cmdr.RemoveOrderedPrefix(s string) string
- Directories
cmdr.DataDir(base ...string) stringcmdr.ConfigDir(base ...string) stringcmdr.CacheDir(base ...string) stringcmdr.HomeDir() stringcmdr.TempDir(base ...string) stringcmdr.TempFileName(fileNamePattern, defaultFileName string, base ...string) (filename string)cmdr.VarLogDir(base ...string) stringcmdr.VarRunDir(base ...string) stringcmdr.UsrLibDir(base ...string) string
- Backwords Compartibilities
cmdr.Exec(rootCmd *cli.RootCommand, opts ...cli.Opt) (err error)
Creator
type Creator interface {
WithOpts(opts ...cli.Opt) Creator
// WithAdders receives a couple of cli.CmdAdder adders
// which can initialize a command standalone.
WithAdders(adders ...cli.CmdAdder) Creator
// WithBuilders receives a couple of callbacks of cli.CommandBuilder
// which can initialize command and flag.
WithBuilders(builders ...func(b cli.CommandBuilder)) Creator
// With a callback, you can initialize commands and
// flags by app object directly.
With(cb func(app cli.App)) Creator
// Build creates the final app object and stop the
// building sequence of a builder pattern.
Build() (app cli.App)
}额外的话题
What is Next?
How is this guide?
最后更新于