flags

package
Version: v0.0.0-...-aed1ee4 Latest Latest
Warning

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

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

Documentation

Overview

Package flags defines extra flag types for use in command line flag parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntMap

type IntMap map[string]int64

IntMap is a map[string]int64 container for command line flags. The default initialization will create an empty map. If you need default backing map use NewIntMap.

func NewIntMap

func NewIntMap(p *map[string]int64, val map[string]int64) *IntMap

NewIntMap will wrap the pointer to the map in a IntMap and set the underlying map to val.

func (*IntMap) Get

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

Get returns the values of m. The interface will need to be type asserted to IntMap for use.

func (*IntMap) Set

func (m *IntMap) Set(v string) error

Set will take a string in the format <key1>=<value1>,<key2>=<value2> and parse the resulting value into a map[string]int64. Values may contain "=", keys may not.

func (*IntMap) String

func (m *IntMap) String() string

type StringList

type StringList []string

StringList is a []string container for command line flags. The default initialization will create an empty slice. If you need default backing slice map use NewStringList.

func NewStringList

func NewStringList(p *[]string, val []string) *StringList

NewStringList will wrap the pointer to the slice in a StringList and set the underlying slice to val.

func (*StringList) Get

func (ss *StringList) Get() interface{}

Get returns the values of ss. The interface will need to be type asserted to StringList for use.

func (*StringList) Set

func (ss *StringList) Set(s string) error

Set sets the value of ss to the comma separated values in s.

func (*StringList) String

func (ss *StringList) String() string

type StringMap

type StringMap map[string]string

StringMap is a map[string]string container for command line flags. The default initialization will create an empty map. If you need default backing map use NewStringMap.

func NewStringMap

func NewStringMap(p *map[string]string, val map[string]string) *StringMap

NewStringMap will wrap the pointer to the map in a StringMap and set the underlying map to val.

func (*StringMap) Get

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

Get returns the values of m. The interface will need to be type asserted to StringMap for use.

func (*StringMap) Set

func (m *StringMap) Set(v string) error

Set will take a string in the format <key1>=<value1>,<key2>=<value2> and parse the resulting value into a map[string]string.

func (*StringMap) String

func (m *StringMap) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL