flagx

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NamedFlagSets

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

NamedFlagSets 存储了命名参数集合

func NewNamedFlagSets added in v1.1.0

func NewNamedFlagSets() *NamedFlagSets

func (*NamedFlagSets) BindFlagSet

func (nfs *NamedFlagSets) BindFlagSet(fs *flag.FlagSet, envPrefix string)

BindFlagSet 将所有的flag绑定到fs中,并从环境变量中读取

func (*NamedFlagSets) CanSet

func (nfs *NamedFlagSets) CanSet(key string, source Source) bool

CanSet 判断key是否可以被source设置,如果已经被更高优先级的source设置,则返回false

func (*NamedFlagSets) FlagSet

func (nfs *NamedFlagSets) FlagSet(name ...string) *flag.FlagSet

FlagSet 返回一个以name为名称的flagSet 如果不存在,则新建一个,并保存到FlagSets映射,添加排序

func (*NamedFlagSets) Set

func (nfs *NamedFlagSets) Set(key string, value string, source Source) error

func (*NamedFlagSets) SetValidateTags

func (nfs *NamedFlagSets) SetValidateTags(tags map[string]string)

func (*NamedFlagSets) VisitAll

func (nfs *NamedFlagSets) VisitAll(fn func(p string, f *flag.Flag))

type Source

type Source interface {
	String() string
	// contains filtered or unexported methods
}

func NewSource added in v1.1.0

func NewSource(name string) Source

Jump to

Keyboard shortcuts

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