flags

package
v0.0.0-...-dc1648f Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidRegexp = errors.New("invalid regular expression")

ErrInvalidRegexp the regular expression doesn't compile.

Functions

This section is empty.

Types

type RegexpValue

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

RegexpValue implements pflag.Value interface to manage an array of regular expressions, thus each command-line flag represents one entry on the array.

func NewRegexpValue

func NewRegexpValue(values *[]regexp.Regexp) *RegexpValue

NewRegexpValue instantiates the RegexpValue with a pointer to the slice, the pointer receives the slice (array) entries.

func (*RegexpValue) Set

func (r *RegexpValue) Set(raw string) error

Set adds a regexp array entry, the raw expression must be compiled successfully.

func (*RegexpValue) String

func (r *RegexpValue) String() string

String shows the current array entries as string.

func (*RegexpValue) Type

func (*RegexpValue) Type() string

Type exposes the "type" to cobra's pflag.Value, a "stringArray" means each command-line flag becomes a single slice entry.

Jump to

Keyboard shortcuts

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