util

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package util provides utility functions for the cmd packages.

Index

Constants

This section is empty.

Variables

View Source
var ErrorNoDefaultIP = errors.New("no suitable IP address")

NoDefaultIP means no suitable non-loopback address can be found.

Functions

func DefaultClientConfig added in v0.3.2

func DefaultClientConfig(flags *pflag.FlagSet) clientcmd.ClientConfig

Copy of kubectl/cmd/DefaultClientConfig, using NewNonInteractiveDeferredLoadingClientConfig

func DefaultLocalIP4

func DefaultLocalIP4() (net.IP, error)

DefaultLocalIP4 returns an IPv4 address that this host can be reached on. Will return NoDefaultIP if no suitable address can be found.

func Env

func Env(key string, defaultValue string) string

Env returns an environment variable or a default value if not specified.

func GetEnv

func GetEnv(key string) (string, bool)

GetEnv returns an environment value if specified

func IsEnvironmentArgument added in v0.3.1

func IsEnvironmentArgument(s string) bool

func PromptForPasswordString added in v0.3.1

func PromptForPasswordString(r io.Reader, format string, a ...interface{}) string

TODO not tested on other platforms

func PromptForString added in v0.3.1

func PromptForString(r io.Reader, format string, a ...interface{}) string

func WaitForSuccessfulDial

func WaitForSuccessfulDial(network, address string, timeout, interval time.Duration, retries int) error

WaitForDial attempts to connect to the given address, closing and returning nil on the first successful connection.

Types

type Environment added in v0.3.1

type Environment map[string]string

func ParseEnvironmentArguments added in v0.3.1

func ParseEnvironmentArguments(s []string) (Environment, []string, []error)

type Mux

type Mux interface {
	Handle(pattern string, handler http.Handler)
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

Mux is a standard mux interface for HTTP

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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