getenv

package
v0.0.0-...-f71f3dc Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package getenv wraps running the appropriate commands for getting the user's environ.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Shell string
	Env   environ.Environ
	// contains filtered or unexported fields
}

Command holds the configuration for running the command necessary to get the EnvVars from the user's shell.

func (*Command) CommandLine

func (s *Command) CommandLine() ([]string, error)

CommandLine returns the appropriate command-line to extract the environ from the user's shell. Currently supports "bash" and "zsh".

func (*Command) Exec

func (s *Command) Exec() ([]byte, error)

Exec runs the necessary command, with the given environ, and returns the Stdout output. StdErr for the command is sent to the user. If No-op mode has been set, the command isn't run, but what would have been run is logged.

func (*Command) ExecToLines

func (s *Command) ExecToLines() ([]string, error)

ExecToLines runs the command, and parses Stdout into an array of NL-separated lines.

Jump to

Keyboard shortcuts

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