cnf

package
v0.0.0-...-4873089 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUnknownPFlags

func CheckUnknownPFlags()

CheckUnknownPFlags checks the pflag and exiting.

func DeclarePflags

func DeclarePflags()

DeclarePflags declares cnf pflags.

func DeclarePflagsByStruct

func DeclarePflagsByStruct(structVars ...interface{})

DeclarePflagsByStruct declares flags from struct fields'name and type

func FindFile

func FindFile(cnfFile string) (string, error)

FindFile tries to find cnfFile from specified path, or current path cnf.toml, executable path cnf.toml.

func GetSeparator

func GetSeparator(v interface{}, defaultSeparator string) string

GetSeparator get separator from 1. viper's separator 2. v which implements Separator interface 3. or default value

func Load

func Load(cnfFile string, values ...interface{})

Load loads the cnfFile content and viper bindings to value.

func LoadByPflag

func LoadByPflag(cfgValues ...interface{})

LoadByPflag load values to cfgValue from pflag cnf specified path.

func LoadE

func LoadE(cnfFile string, values ...interface{}) error

LoadE similar to Load.

func ParsePflags

func ParsePflags(envPrefix string) error

ParsePflags parse pflags and bind to viper

func ViperToStruct

func ViperToStruct(structVars ...interface{})

ViperToStruct read viper value to struct

Types

type Separator

type Separator interface {
	// GetSeparator get the separator
	GetSeparator() string
}

Separator ...

Jump to

Keyboard shortcuts

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