hzDocs

顶级函数

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.Runner
      • cmdr.AppName() string
      • cmdr.AppVersion() string
      • cmdr.AppDescription() string
      • cmdr.AppDescriptionLong() string
      • cmdr.CmdLines() []string
  • Errors

    • cmdr.Error() errors.Error
    • cmdr.Recycle(errs ...error)
  • Parsing

    • cmdr.Parsed() bool
    • cmdr.ParsedLastCmd() cli.Cmd
    • cmdr.ParsedCommands() []cli.Cmd
    • cmdr.ParsedPositionalArgs() []string
  • Store

    • cmdr.Store(prefix ...string) store.Store
    • cmdr.Set(prefix ...string) store.Store
    • cmdr.LoadedSources() []cli.LoadedSources
  • Utilities

    • cmdr.RemoveOrderedPrefix(s string) string
  • Directories

    • cmdr.DataDir(base ...string) string
    • cmdr.ConfigDir(base ...string) string
    • cmdr.CacheDir(base ...string) string
    • cmdr.HomeDir() string
    • cmdr.TempDir(base ...string) string
    • cmdr.TempFileName(fileNamePattern, defaultFileName string, base ...string) (filename string)
    • cmdr.VarLogDir(base ...string) string
    • cmdr.VarRunDir(base ...string) string
    • cmdr.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)
}

额外的话题

How is this guide?

Edit on GitHub

Last updated on

On this page