flagutil

package
v3.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package flagutil contains flags that parse string lists and string maps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringListVar

func StringListVar(p *[]string, name string, defaultValue []string, usage string)

StringListVar defines a []string flag with the specified name, value and usage string. The argument 'p' points to a []string in which to store the value of the flag.

Types

type StringListValue

type StringListValue []string

StringListValue is a []string flag that accepts a comma separated list of elements. To include an element containing a comma, quote it with a backslash '\'.

func (StringListValue) Get

func (value StringListValue) Get() interface{}

Get returns the []string value of this flag.

func (*StringListValue) Set

func (value *StringListValue) Set(v string) error

Set sets the value of this flag from parsing the given string.

func (StringListValue) String

func (value StringListValue) String() string

String returns the string representation of this flag.

type StringMapValue

type StringMapValue map[string]string

StringMapValue is a map[string]string flag. It accepts a comma-separated list of key value pairs, of the form key:value. The keys cannot contain colons.

func (StringMapValue) Get

func (value StringMapValue) Get() interface{}

Get returns the map[string]string value of this flag.

func (*StringMapValue) Set

func (value *StringMapValue) Set(v string) error

Set sets the value of this flag from parsing the given string.

func (StringMapValue) String

func (value StringMapValue) String() string

String returns the string representation of this flag.

Jump to

Keyboard shortcuts

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