flagx

package
v3.16.5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package flagx contains extensions for the standard library flag package. The code is adapted from github.com/m-lab/go and more specifically from <https://git.io/JJ8UA>. This file is licensed under version 2.0 of the Apache License <https://git.io/JJ8Ux>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringArray

type StringArray []string

StringArray is a new flag type. It appends the flag parameter to an `[]string` allowing the parameter to be specified multiple times or using "," separated items. Unlike other Flag types, the default argument should almost always be the empty array, because there is no way to remove an element, only to add one.

func (StringArray) Contains

func (sa StringArray) Contains(value string) bool

Contains returns true when the given value equals one of the StringArray values.

func (StringArray) Get

func (sa StringArray) Get() interface{}

Get retrieves the value contained in the flag.

func (*StringArray) Set

func (sa *StringArray) Set(s string) error

Set accepts a string parameter and appends it to the associated StringArray. Set attempts to split the given string on commas "," and appends each element to the StringArray.

func (StringArray) String

func (sa StringArray) String() string

String reports the StringArray as a Go value.

Jump to

Keyboard shortcuts

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