envflag

package
v0.9.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init[T any](flags *T, envVar string) error

Init initializes the fields in flags from the attached struct field tags as well as the contents of the given environment variable.

The struct field tag may contain a default value other than the zero value, such as `envflag:"default:true"` to set a boolean field to true by default.

The environment variable may contain a comma-separated list of name=value pairs values representing the boolean fields in the struct type T. If the value is omitted entirely, the value is assumed to be name=true.

Names are treated case insensitively. Value strings are parsed as Go booleans via strconv.ParseBool, meaning that they accept "true" and "false" but also the shorter "1" and "0".

Types

This section is empty.

Jump to

Keyboard shortcuts

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