environment

package
v0.41.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2017 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package environment allow environment variables to be obtained from either the environment or the command line. Environment variables are always uppercase, with the Prefix; flags are always lowercase without.

Index

Constants

View Source
const Prefix = "DOCUMIZE"

Prefix provides the prefix for all Environment variables

Variables

This section is empty.

Functions

func GetString

func GetString(target *string, name string, required bool, usage string, callback CallbackT)

GetString sets-up the flag for later use, it must be called before ParseOK(), usually in an init().

func Parse

func Parse(doFirst string)

Parse calls flag.Parse() then checks that the required environment variables are all set. It should be the first thing called by any main() that uses this library. If all the required variables are not present, it prints an error and calls os.Exit(2) like flag.Parse().

Types

type CallbackT

type CallbackT func(*string, string) bool

CallbackT is the type signature of the callback function of GetString().

Jump to

Keyboard shortcuts

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