x

package module
v0.0.0-...-1457574 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: MIT Imports: 8 Imported by: 0

README

eXperimental Go Stuff

This repository contains packages (experimental or useful for me only) with no promises or guarantees.

Licensing

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseFatal

func CloseFatal(c io.Closer)

CloseFatal closes the given Closer and calls log.Fatalf on error.

func ClosePrint

func ClosePrint(c io.Closer)

ClosePrint closes the given Closer and logs any error without terminating.

func DynamicReader

func DynamicReader(name string) (io.ReadCloser, error)

DynamicReader returns a reader based on the name. Use "-" or "stdin" for os.Stdin. Empty name will return os.Stdin if it has data.

func DynamicWriter

func DynamicWriter(name string, append bool) (io.WriteCloser, error)

DynamicWriter returns a writer based on the name. Use "-" or "stdout" for os.Stdout, "=" or "stderr" for os.Stderr. Any other name opens a file in `append` mode if enabled.

func FlagsArgs

func FlagsArgs(args []string, extras ...FlagOption) ([]string, error)

FlagsArgs parses command-line arguments and returns the remaining non-flag arguments after parsing. It creates a new FlagSet with the provided options, parses the args, and returns unparsed arguments and any error.

func FlagsParse

func FlagsParse(args []string, extras ...FlagOption) error

FlagsParse parses command-line arguments into a flag.FlagSet, applying customizations via provided FlagOption functions.

func PrintErr

func PrintErr(err error)

Types

type FlagOption

type FlagOption func(*flag.FlagSet)

FlagOption is a function type used to customize a flag.FlagSet during its initialization.

func Flag

func Flag[T flaggables](p *T, name, usage string) FlagOption

func FlagSetErrorHandling

func FlagSetErrorHandling(errorHandling flag.ErrorHandling) FlagOption

FlagSetErrorHandling changes the name in the flag.FlagSet.

func FlagSetName

func FlagSetName(name string) FlagOption

FlagSetName changes the name in the flag.FlagSet.

func FlagText

func FlagText(p encoding.TextUnmarshaler, name string, value encoding.TextMarshaler, usage string) FlagOption

FlagText defines a flag with a custom TextMarshaler and TextUnmarshaler to parse and format its value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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