flagutil

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0, NCSA Imports: 9 Imported by: 20

Documentation

Overview

Package flagutil is a collection of helper functions for Kythe binaries using the flag package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SimpleUsage

func SimpleUsage(description string, args ...string) func()

SimpleUsage returns a basic flag.Usage function that prints the given description and list of arguments in the following format:

Usage: binary <arg0> <arg1> ... <argN>
<description>

<build.VersionLine()>

Flags:
<flag.PrintDefaults()>

func UsageError

func UsageError(msg string)

UsageError prints msg to stderr, calls flag.Usage, and exits the program unsuccessfully.

func UsageErrorf

func UsageErrorf(str string, vals ...any)

UsageErrorf prints str formatted with the given vals to stderr, calls flag.Usage, and exits the program unsuccessfully.

Types

type IntList added in v0.0.50

type IntList []int

IntList implements a flag.Value that accepts multiple values by repeatedly specifying the flag.

func (*IntList) Set added in v0.0.50

func (i *IntList) Set(value string) error

Set adds a value to the flag's list of integers.

func (*IntList) String added in v0.0.50

func (i *IntList) String() string

String returns a string representation of the flag's value.

type StringList added in v0.0.31

type StringList []string

StringList implements a flag.Value that accepts an sequence of values as a CSV.

func (*StringList) Get added in v0.0.31

func (f *StringList) Get() any

Get implements flag.Getter and returns a slice of string values.

func (*StringList) Set added in v0.0.31

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

Set implements part of the flag.Getter interface and will append new values to the flag.

func (*StringList) String added in v0.0.31

func (f *StringList) String() string

String implements part of the flag.Getter interface and returns a string-ish value for the flag.

type StringMultimap added in v0.0.31

type StringMultimap map[string]stringset.Set

StringMultimap implements a flag.Value that accepts an set of key-value entries as a CSV.

func (*StringMultimap) Get added in v0.0.31

func (f *StringMultimap) Get() any

Get implements flag.Getter and returns a slice of string values.

func (*StringMultimap) Set added in v0.0.31

func (f *StringMultimap) Set(s string) error

Set implements part of the flag.Getter interface and will append new values to the flag.

func (*StringMultimap) String added in v0.0.31

func (f *StringMultimap) String() string

String implements part of the flag.Getter interface and returns a string-ish value for the flag.

type StringSet added in v0.0.31

type StringSet stringset.Set

StringSet implements a flag.Value that accepts an set of values as a CSV.

func (*StringSet) Elements added in v0.0.31

func (f *StringSet) Elements() []string

Elements returns the set of elements as a sorted slice.

func (*StringSet) Get added in v0.0.31

func (f *StringSet) Get() any

Get implements flag.Getter and returns a slice of string values.

func (*StringSet) Len added in v0.0.31

func (f *StringSet) Len() int

Len returns the number of elements.

func (*StringSet) Set added in v0.0.31

func (f *StringSet) Set(s string) error

Set implements part of the flag.Getter interface and will append new values to the flag.

func (*StringSet) String added in v0.0.31

func (f *StringSet) String() string

String implements part of the flag.Getter interface and returns a string-ish value for the flag.

func (*StringSet) Update added in v0.0.31

func (f *StringSet) Update(o StringSet) bool

Update adds the values from other to the contained stringset.

Jump to

Keyboard shortcuts

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