cli

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrConfigNotSupportedProtocol = "ConfigNotSupportedProtocol"
)

Variables

This section is empty.

Functions

func ViperAddArgument

func ViperAddArgument(cmd *cobra.Command, a Argument) error

ViperAddArgument provides a data driven way to add cli arguments

func ViperAddArguments

func ViperAddArguments(cmd *cobra.Command, aList []Argument) error

ViperAddArguments allows you to pass in many argument configs

func ViperConfig

func ViperConfig(configName string) error

ViperConfig will help configure a project. This includes setting the environment variable prefix, plus the default config file name. For example:

cli.ViperConfig("ears")

Types

type ArgError

type ArgError struct {
	Err error
	// contains filtered or unexported fields
}

func (ArgError) Error

func (a ArgError) Error() string

func (ArgError) Key

func (a ArgError) Key() string

func (*ArgError) Unwrap

func (a *ArgError) Unwrap() error

func (ArgError) Value

func (a ArgError) Value() interface{}

type ArgType

type ArgType string
const (
	ArgTypeInt         ArgType = "int"
	ArgTypeIntSlice    ArgType = "[]int"
	ArgTypeFloat       ArgType = "float"
	ArgTypeFloatSlice  ArgType = "[]float"
	ArgTypeString      ArgType = "string"
	ArgTypeStringSlice ArgType = "[]string"
	ArgTypeBool        ArgType = "bool"
	ArgTypeBoolSlice   ArgType = "[]bool"
)

type Argument

type Argument struct {
	Name        string
	Shorthand   string
	Type        ArgType
	Description string
	Default     interface{}
	LookupKey   string
	Persistent  bool
}

type Config

type Config struct {
	EnvPrefix string
	Name      string
	Paths     []string
}

type ConfigError

type ConfigError struct {
	Err error
	// contains filtered or unexported fields
}

func (ConfigError) Error

func (c ConfigError) Error() string

func (ConfigError) Path

func (c ConfigError) Path() string

func (*ConfigError) Unwrap

func (c *ConfigError) Unwrap() error

Jump to

Keyboard shortcuts

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