arguments

package
v0.0.0-...-de7d1e5 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBool

func FormatBool(a *Argument[bool]) string

func FormatFriendlyFireRate

func FormatFriendlyFireRate(a *Argument[float64]) string

func FormatGameDifficulty

func FormatGameDifficulty(a *Argument[int]) string

func FormatGameLength

func FormatGameLength(a *Argument[int]) string

func FormatGameMode

func FormatGameMode(a *Argument[string]) string

func FormatSpecimenType

func FormatSpecimenType(a *Argument[string]) string

func ParseDuration

func ParseDuration(a *Argument[time.Duration]) (time.Duration, error)

func ParseExistingDir

func ParseExistingDir(a *Argument[string]) (string, error)

func ParseFriendlyFireRate

func ParseFriendlyFireRate(a *Argument[float64]) (float64, error)

func ParseGameDifficulty

func ParseGameDifficulty(raw string) func(a *Argument[int]) (int, error)

func ParseGameLength

func ParseGameLength(raw string) func(a *Argument[int]) (int, error)

func ParseGameMode

func ParseGameMode(a *Argument[string]) (string, error)

func ParseIP

func ParseIP(a *Argument[string]) (string, error)

func ParseIntRange

func ParseIntRange(a *Argument[int], min int, max int) func(a *Argument[int]) (int, error)

func ParseLogFileFormat

func ParseLogFileFormat(a *Argument[string]) (string, error)

func ParseLogLevel

func ParseLogLevel(a *Argument[string]) (string, error)

func ParseMail

func ParseMail(a *Argument[string]) (string, error)

func ParseNonEmptyStr

func ParseNonEmptyStr(a *Argument[string]) (string, error)

func ParsePassword

func ParsePassword(a *Argument[string]) (string, error)

func ParsePort

func ParsePort(a *Argument[int]) (int, error)

func ParsePositiveInt

func ParsePositiveInt(a *Argument[int]) (int, error)

func ParseSpecimenType

func ParseSpecimenType(a *Argument[string]) (string, error)

func ParseURL

func ParseURL(a *Argument[string]) (string, error)

func ParseUnsignedInt

func ParseUnsignedInt(a *Argument[int]) (int, error)

Types

type Argument

type Argument[T any] struct {
	// contains filtered or unexported fields
}

func New

func New[T any](name string, rawValue T, parseFunc ParseFunction[T], formatFunc FormatFunction[T], sensitive bool) *Argument[T]

func (*Argument[T]) FormattedValue

func (a *Argument[T]) FormattedValue() string

func (*Argument[T]) IsSensitive

func (a *Argument[T]) IsSensitive() bool

func (*Argument[T]) Name

func (a *Argument[T]) Name() string

func (*Argument[T]) Parse

func (a *Argument[T]) Parse() error

func (*Argument[T]) RawValue

func (a *Argument[T]) RawValue() T

func (*Argument[T]) SetFormatterFunction

func (a *Argument[T]) SetFormatterFunction(f FormatFunction[T])

func (*Argument[T]) SetParserFunction

func (a *Argument[T]) SetParserFunction(f ParseFunction[T])

func (*Argument[T]) String

func (a *Argument[T]) String() string

func (*Argument[T]) Value

func (a *Argument[T]) Value() T

type FormatFunction

type FormatFunction[T any] func(a *Argument[T]) string

type ParsableArgument

type ParsableArgument interface {
	Parse() error
	Name() string
	FormattedValue() string
	IsSensitive() bool
}

type ParseFunction

type ParseFunction[T any] func(a *Argument[T]) (T, error)

Jump to

Keyboard shortcuts

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