flagx

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package flagx provides additional flag functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FloatBetween

func FloatBetween(name string, value float64, usage string,
	minVal, maxVal float64, incMin, incMax bool) *float64

FloatBetween defines a float flag with specified name, default value, usage string and bounds. incMin and incMax define whether min and max are included in the allowed values. The return value is the address of a float variable that stores the value of the flag.

func FloatBetweenFlagSet

func FloatBetweenFlagSet(fs *flag.FlagSet, name string, value float64,
	usage string, minVal, maxVal float64, incMin, incMax bool) *float64

FloatBetweenFlagSet defines a float flag with specified name, default value, usage string and bounds. incMin and incMax define whether min and max are included in the allowed values. The return value is the address of a float variable that stores the value of the flag.

func IntBetween

func IntBetween(name string, value int, usage string, minVal, maxVal int) *int

IntBetween defines an int flag with specified name, default value, usage string and bounds. The return value is the address of an int variable that stores the value of the flag.

func IntBetweenFlagSet

func IntBetweenFlagSet(fs *flag.FlagSet, name string,
	value int, usage string, minVal, maxVal int) *int

IntBetweenFlagSet defines an int flag with specified name, default value, usage string and bounds. The return value is the address of an int variable that stores the value of the flag.

func Regexp

func Regexp(name string, value *regexp.Regexp, usage string) **regexp.Regexp

Regexp defines a regular expression flag with specified name, default value, and usage string. The return value is the address of a regular expression variable that stores the value of the flag.

func RegexpFlagSet

func RegexpFlagSet(fs *flag.FlagSet, name string,
	value *regexp.Regexp, usage string) **regexp.Regexp

RegexpFlagSet defines a regular expression flag with specified name, default value, and usage string. The return value is the address of a regular expression variable that stores the value of the flag.

func StringFrom

func StringFrom(name string, value string, usage string, from ...string) *string

StringFrom defines a string flag with specified name, default value, usage string and allowed values. The return value is the address of a string variable that stores the value of the flag.

func StringFromFlagSet

func StringFromFlagSet(fs *flag.FlagSet, name string, value string,
	usage string, from ...string) *string

StringFromFlagSet defines a string flag with specified name, default value, usage string and allowed values. The return value is the address of a string variable that stores the value of the flag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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