flag

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(fs *pflag.FlagSet)

AddFlags registers this package's flags on arbitrary FlagSets, such that they point to the same value as the global flags.

func ConfigVar

func ConfigVar(p *ConfigValue, name string, value ConfigValue, usage string)

func PrintDefaultConfigAndExitIfRequested

func PrintDefaultConfigAndExitIfRequested(config interface{})

PrintDefaultConfigAndExitIfRequested will check if the -defaultconfig flag was passed and, if so, print the default config and exit.

func PrintFlags

func PrintFlags(flags *pflag.FlagSet)

PrintFlags logs the flags in the flagset

func PrintMinConfigAndExitIfRequested

func PrintMinConfigAndExitIfRequested(config interface{})

PrintMinConfigAndExitIfRequested will check if the -minconfig flag was passed and, if so, print the min config and exit.

Types

type ConfigValue

type ConfigValue int
const (
	ConfigFalse ConfigValue = 0
	ConfigTrue  ConfigValue = 1
)

func Config

func Config(name string, value ConfigValue, usage string) *ConfigValue

func (*ConfigValue) Get

func (m *ConfigValue) Get() interface{}

func (*ConfigValue) IsBoolFlag

func (m *ConfigValue) IsBoolFlag() bool

func (*ConfigValue) Set

func (m *ConfigValue) Set(s string) error

func (*ConfigValue) String

func (m *ConfigValue) String() string

func (*ConfigValue) Type

func (m *ConfigValue) Type() string

The type of the flag as required by the pflag.Value interface

Jump to

Keyboard shortcuts

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