envflag

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package envflag is a simple library for associating environment variables with flags.

If using the default flag.CommandLine FlagSet, just call envflag.Parse() instead of flag.Parse().

Assign environment variables to flags using the Map type:

var m := envflag.Map{
    "MY_ENV_VAR": "my-flag"
}

If the flag and the environment variable is set the flag takes precidence.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(m Map)

func ParseFlagSet

func ParseFlagSet(fs *flag.FlagSet, args []string, m Map) error

Types

type Map

type Map map[string]string

func (Map) Assign

func (m Map) Assign(fs *flag.FlagSet) error

Jump to

Keyboard shortcuts

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