env

package
v0.0.0-...-1a56975 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package env makes it possible to track use of environment variables within a procress in order to generate documentation for these uses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterVar

func RegisterVar(v Var)

RegisterVar registers a generic environment variable.

Types

type BoolVar

type BoolVar struct {
	Var
}

BoolVar represents a single boolean environment variable.

func RegisterBoolVar

func RegisterBoolVar(name string, defaultValue bool, description string) BoolVar

RegisterBoolVar registers a new boolean environment variable.

func (BoolVar) Get

func (v BoolVar) Get() bool

func (BoolVar) Lookup

func (v BoolVar) Lookup() (bool, bool)

type DurationVar

type DurationVar struct {
	Var
}

DurationVar represents a single duration environment variable.

func RegisterDurationVar

func RegisterDurationVar(name string, defaultValue time.Duration, description string) DurationVar

RegisterDurationVar registers a new duration environment variable.

func (DurationVar) Get

func (v DurationVar) Get() time.Duration

func (DurationVar) Lookup

func (v DurationVar) Lookup() (time.Duration, bool)

type FloatVar

type FloatVar struct {
	Var
}

FloatVar represents a single floating-point environment variable.

func RegisterFloatVar

func RegisterFloatVar(name string, defaultValue float64, description string) FloatVar

RegisterFloatVar registers a new floating-point environment variable.

func (FloatVar) Get

func (v FloatVar) Get() float64

func (FloatVar) Lookup

func (v FloatVar) Lookup() (float64, bool)

type IntVar

type IntVar struct {
	Var
}

IntVar represents a single integer environment variable.

func RegisterIntVar

func RegisterIntVar(name string, defaultValue int, description string) IntVar

RegisterIntVar registers a new integer environment variable.

func (IntVar) Get

func (v IntVar) Get() int

func (IntVar) Lookup

func (v IntVar) Lookup() (int, bool)

type StringVar

type StringVar struct {
	Var
}

StringVar represents a single string environment variable.

func RegisterStringVar

func RegisterStringVar(name string, defaultValue string, description string) StringVar

RegisterStringVar registers a new string environment variable.

func (StringVar) Get

func (v StringVar) Get() string

func (StringVar) Lookup

func (v StringVar) Lookup() (string, bool)

type Var

type Var struct {
	// The name of the environment variable.
	Name string

	// The optional default value of the environment variable.
	DefaultValue string

	// Description of the environment variable's purpose.
	Description string

	// Hide the existence of this variable when outputting usage information.
	Hidden bool

	// Mark this variable as deprecated when generating usage information.
	Deprecated bool

	// The type of the variable's value
	Type VarType
}

Var describes a single environment variable

func VarDescriptions

func VarDescriptions() []Var

Returns a description of this process' environment variables, sorted by name.

type VarType

type VarType byte

The type of a variable's value

const (
	STRING VarType = iota
	BOOL
	INT
	FLOAT
	DURATION
)

Jump to

Keyboard shortcuts

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