util

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package util contains useful functions for client.

Index

Constants

View Source
const AppHelp = `` /* 357-byte string literal not displayed */

AppHelp -- custom application help template for "cli".

Variables

View Source
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

func MustGetOptions(ctx *cli.Context) *config.Options

MustGetOptions extracts program options from context. It panics if options not found in context.

func OptionsFromContext

func OptionsFromContext(ctx *cli.Context) (opts *config.Options, err error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL