basicflag

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: MIT Imports: 3 Imported by: 9

Documentation

Overview

Package basicflag implements a koanf.Provider that reads commandline parameters as conf maps using the Go's flag package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pflag

type Pflag struct {
	// contains filtered or unexported fields
}

Pflag implements a pflag command line provider.

func Provider

func Provider(f *flag.FlagSet, delim string) *Pflag

Provider returns a commandline flags provider that returns a nested map[string]interface{} of environment variable where the nesting hierarchy of keys are defined by delim. For instance, the delim "." will convert the key `parent.child.key: 1` to `{parent: {child: {key: 1}}}`.

func (*Pflag) Read

func (p *Pflag) Read() (map[string]interface{}, error)

Read reads the flag variables and returns a nested conf map.

func (*Pflag) ReadBytes

func (p *Pflag) ReadBytes() ([]byte, error)

ReadBytes is not supported by the env koanf.

func (*Pflag) Watch added in v0.5.0

func (p *Pflag) Watch(cb func(event interface{}, err error)) error

Watch is not supported.

Jump to

Keyboard shortcuts

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