Documentation ¶
Overview ¶
Package util contains useful functions for client.
Index ¶
- Constants
- Variables
- func MustGetClientConstructor(ctx *cli.Context) client.Constructor
- func MustGetOptions(ctx *cli.Context) *config.Options
- func OptionsFromContext(ctx *cli.Context) (opts *config.Options, err error)
- func OptionsToTOML(ctx *cli.Context) error
- func PrintCompletion(ctx *cli.Context)
- func SetupClientConstructor(ctx *cli.Context) error
- func SetupLogger(ctx *cli.Context)
- func SetupOptions(ctx *cli.Context) error
Constants ¶
const AppHelp = `` /* 357-byte string literal not displayed */
AppHelp -- custom application help template for "cli".
Variables ¶
var InitCompletionFlag = &cli.StringFlag{
Name: "create-completion",
Usage: "generate completion code. Value must be 'bash' or 'zsh'",
}
InitCompletionFlag generates completion code
Functions ¶
func MustGetClientConstructor ¶
func MustGetClientConstructor(ctx *cli.Context) client.Constructor
MustGetClientConstructor extracts client constructor from context. It panics if it not found in context.
func MustGetOptions ¶
MustGetOptions extracts program options from context. It panics if options not found in context.
func OptionsFromContext ¶
OptionsFromContext extracts program options from command-line flags. For flags description see "flags" package.
func OptionsToTOML ¶
func OptionsToTOML(ctx *cli.Context) error
OptionsToTOML saves options to toml-encoded file
func PrintCompletion ¶
func PrintCompletion(ctx *cli.Context)
PrintCompletion prints a generated bash or zsh completion script.
func SetupClientConstructor ¶
func SetupClientConstructor(ctx *cli.Context) error
SetupClientConstructor injects client constructor to context.
func SetupLogger ¶
func SetupLogger(ctx *cli.Context)
SetupLogger sets up logger for debug information according to flags.
func SetupOptions ¶
func SetupOptions(ctx *cli.Context) error
SetupOptions sets up application options. It calls "OptionsFromContext" to load options, optionally saves it to files using "OptionsToToml" and finally injects it to context.
Types ¶
This section is empty.