cliconfig

package
v3.19.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(c *cli.Context, l logger.Logger, cfg interface{}) error

A shortcut for loading a config from the CLI

Types

type File

type File struct {
	// The path to the file
	Path string

	// A map of key/values that was loaded from the file
	Config map[string]string
}

func (File) AbsolutePath

func (f File) AbsolutePath() (string, error)

func (File) Exists

func (f File) Exists() bool

func (*File) Load

func (f *File) Load() error

type Loader

type Loader struct {
	// The context that is passed when using a codegangsta/cli action
	CLI *cli.Context

	// The struct that the config values will be loaded into
	Config interface{}

	// The logger used
	Logger logger.Logger

	// A slice of paths to files that should be used as config files
	DefaultConfigFilePaths []string

	// The file that was used when loading this configuration
	File *File
}

func (Loader) Errorf

func (l Loader) Errorf(format string, v ...interface{}) error

func (*Loader) Load

func (l *Loader) Load() (warnings []string, err error)

Loads the config from the CLI and config files that are present and returns any warnings or errors

Jump to

Keyboard shortcuts

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