flagfx

package
v0.0.0-...-3b96a7a Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"winterfx_core_flagfx",
	fx.Provide(
		ArgsFromCommandLine,
		New,
	),
	fx.Invoke(Parse),
)

Functions

func AsDecoderFunc

func AsDecoderFunc[T any](fn func(fset *flag.FlagSet) *T) func(fset *flag.FlagSet) DecoderResult[T]

AsDecoderFunc wraps a flag set decoder function with joint points

func New

func New() *flag.FlagSet

New creates a new flag set

func OverrideArgs

func OverrideArgs(v []string) fx.Option

OverrideArgs supplies the command-line arguments

func Parse

func Parse(opts ParseOptions) error

Parse parses the flag set with ff

Types

type Args

type Args []string

Args is the command-line arguments

func ArgsFromCommandLine

func ArgsFromCommandLine() Args

ArgsFromCommandLine loads the flag set args from command-line arguments

type DecoderResult

type DecoderResult[T any] struct {
	fx.Out
	JointPoint JointPoint `group:"winterfx_core_flagfx_jointpoints"`

	Value *T
}

type JointPoint

type JointPoint struct{}

JointPoint is a joint point for ensuring all decoder functions are called before parsing flagset

type ParseOptions

type ParseOptions struct {
	fx.In
	JointPoint []JointPoint `group:"winterfx_core_flagfx_jointpoints"`

	FlagSet *flag.FlagSet
	Args    Args
}

ParseOptions is the options for parsing flag set

Jump to

Keyboard shortcuts

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