util

package
v0.0.0-...-f17ef4b Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConfirmation

func CheckConfirmation(stdin io.Reader, stdout io.Writer, name string) (bool, error)

CheckConfirmation prompts the user for confirmation and returns true IFF the user responds with 'yes'

func FindUserIP

func FindUserIP() (string, error)

FindUserIP gets the user's public IP by querying whatismyip.akamai.com

func GeneratePassword

func GeneratePassword() string

GeneratePassword a random password

func GenerateSSHKeyPair

func GenerateSSHKeyPair() ([]byte, []byte, error)

GenerateSSHKeyPair generates a new ssh public key pair http://stackoverflow.com/questions/21151714/go-generate-an-ssh-public-key

func Indent

func Indent(countStr, field string) string

Indent is a helper function to indent the field a given number of spaces

func RenderTemplate

func RenderTemplate(templateStr string, params interface{}) ([]byte, error)

RenderTemplate renders a template to a string

Types

type TempDir

type TempDir struct {
	// contains filtered or unexported fields
}

TempDir represents a temporary directory to store files

func NewTempDir

func NewTempDir() (*TempDir, error)

NewTempDir returns a new temporary directory

func (*TempDir) Cleanup

func (tempDir *TempDir) Cleanup() error

Cleanup deletes the tempDir

func (*TempDir) Path

func (tempDir *TempDir) Path(filename string) string

Path returns a path for the given file into the tempDir

func (*TempDir) PushDir

func (tempDir *TempDir) PushDir(callback func() error) error

PushDir runs the function in the tempDir

func (*TempDir) Save

func (tempDir *TempDir) Save(filename string, contents []byte) (string, error)

Save writes the given file into the tempDir

Jump to

Keyboard shortcuts

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