envflag

package
v0.0.0-...-05eea06 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package envflag provides a wrapper around the standard flag package that can fall back to environment variables

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(name string, value bool, usage string) *bool

Bool defines a bool flag with specified name, default value, and usage string. If an environment variable with the same name as the flag is set, it will be used instead of the default value. The return value is the address of a bool variable that stores the value of the flag.

func Int

func Int(name string, value int, usage string) *int

Int defines an int flag with specified name, default value, and usage string. If an environment variable with the same name as the flag is set, it will be used instead of the default value. The return value is the address of an int variable that stores the value of the flag.

func Parse

func Parse()

Parse parses the command-line flags from os.Args[1:]. Must be called after all flags are defined and before flags are accessed by the program.

func String

func String(name string, value string, usage string) *string

String defines a string flag with specified name, default value, and usage string. If an environment variable with the same name as the flag is set, it will be used instead of the default value. 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