cliconfig

package
v3.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 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, 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{}

	// 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() error

Loads the config from the CLI and config files that are present.

Jump to

Keyboard shortcuts

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