{"modulePath":"github.com/mirovskyi/traefik","version":"v2.0.0-beta1.0.20190806192659-88ebac942ed8+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package cli\n\nPackage cli provides tools to create commands that support advanced configuration features, sub-commands, and allowing configuration from command-line flags, configuration files, and environment variables.\n\n## Functions\n\n```go\nfunc Execute(cmd *Command) error\n```\nExecute Executes a command.\n\n```go\nfunc PrintHelp(w io.Writer, cmd *Command) error\n```\nPrintHelp prints the help for the command given as argument.\n\n## Types\n\n```go\ntype Command struct {\n\tName          string\n\tDescription   string\n\tConfiguration interface{}\n\tResources     []ResourceLoader\n\tRun           func([]string) error\n\tHidden        bool\n\t// AllowArg if not set, disallows any argument that is not a known command or a sub-command.\n\tAllowArg bool\n\t// contains filtered or unexported fields\n}\n```\nCommand structure contains program/command information (command name and description).\n\n```go\nfunc (c *Command) AddCommand(cmd *Command) error\n```\nAddCommand Adds a sub command.\n\n```go\ntype EnvLoader struct{}\n```\nEnvLoader loads a configuration from all the environment variables prefixed with \"TRAEFIK\\_\".\n\n```go\nfunc (e *EnvLoader) Load(_ []string, cmd *Command) (bool, error)\n```\nLoad loads the command's configuration from the environment variables.\n\n```go\ntype FileLoader struct {\n\tConfigFileFlag string\n\t// contains filtered or unexported fields\n}\n```\nFileLoader loads a configuration from a file.\n\n```go\nfunc (f *FileLoader) GetFilename() string\n```\nGetFilename returns the configuration file if any.\n\n```go\nfunc (f *FileLoader) Load(args []string, cmd *Command) (bool, error)\n```\nLoad loads the command's configuration from a file either specified with the -traefik.configfile flag, or from default locations.\n\n```go\ntype Finder struct {\n\tBasePaths  []string\n\tExtensions []string\n}\n```\nFinder holds a list of file paths.\n\n```go\nfunc (f Finder) Find(configFile string) (string, error)\n```\nFind returns the first valid existing file among configFile and the paths already registered with Finder.\n\n```go\ntype FlagLoader struct{}\n```\nFlagLoader loads configuration from flags.\n\n```go\nfunc (*FlagLoader) Load(args []string, cmd *Command) (bool, error)\n```\nLoad loads the command's configuration from flag arguments.\n\n```go\ntype ResourceLoader interface {\n\t// Load populates cmd.Configuration, optionally using args to do so.\n\tLoad(args []string, cmd *Command) (bool, error)\n}\n```\nResourceLoader is a configuration resource loader.\n\n","path":"github.com/mirovskyi/traefik/pkg/cli","name":"cli","synopsis":"Package cli provides tools to create commands that support advanced configuration features, sub-commands, and allowing configuration from command-line flags, configuration files, and environment variables.","isRedistributable":true}
