environment

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2018 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package environment providies utilities for managing environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(wd string) ([]string, error)

Initialize sets a bunch of environment variables and then returns the name of them in a string slice. It will also determine what version control, if any is in use, and set variables for it as well.

func Map added in v0.10.2

func Map(key string, env []string) string

Map will return the value matching a KEY=VAL pair in the given environment.

func Mapper

func Mapper(str string, env []string) (string, error)

Mapper will replace ${TEMPLATE} patterns in the string with the KEY=VAL pairs in the given environment. This function will replace patterns recursively, so if VAL has the form ${TEMPLATE}, it will be replaced again.

func Merge added in v0.2.0

func Merge(orig, update []string) []string

Merge combines two environments and returns the result.

func Prune added in v0.11.0

func Prune(env []string) []string

Prune removes all empty-value variables from the environment.

func SliceMapper added in v0.8.0

func SliceMapper(slice []string, env []string) ([]string, error)

SliceMapper calls Mapper for each item in a slice and returns a new slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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