flags

package
v0.0.0-...-552cffb Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseHostPortAddr

func ParseHostPortAddr(s string) ([]string, error)

ParseHostPortAddr returns a scheme://host:port or host:port list

func SetFlagsFromEnv

func SetFlagsFromEnv(prefix string, fs *flag.FlagSet) error

SetFlagsFromEnv parses all registered flags in the given flagset, and if they are not already set it attempts to set their values from environment variables. Environment variables take the name of the flag but are UPPERCASE, have the given prefix and any dashes are replaced by underscores - for example: some-flag => PUMP_SOME_FLAG

func URLStrsFromFlag

func URLStrsFromFlag(fs *flag.FlagSet, urlsFlagName string) []string

URLStrsFromFlag returns a string slices from url got from the flag.

func URLsFromFlag

func URLsFromFlag(fs *flag.FlagSet, urlsFlagName string) []url.URL

URLsFromFlag returns a slices from url got from the flag.

Types

type URLsValue

type URLsValue types.URLs

URLsValue define a slice of URLs as a type

func NewURLsValue

func NewURLsValue(init string) (*URLsValue, error)

NewURLsValue return a URLsValue from a string of URLs list

func (*URLsValue) HostString

func (us *URLsValue) HostString() string

HostString return a string of host:port format list separated by comma

func (*URLsValue) Set

func (us *URLsValue) Set(s string) error

Set parses a command line set of URLs formatted like: http://127.0.0.1:2380,http://10.1.1.2:80

func (*URLsValue) String

func (us *URLsValue) String() string

func (*URLsValue) StringSlice

func (us *URLsValue) StringSlice() []string

StringSlice return a slice of string with formatted URL

func (*URLsValue) URLSlice

func (us *URLsValue) URLSlice() []url.URL

URLSlice return a slice of URLs

Jump to

Keyboard shortcuts

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