cli

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtExit

func AtExit(f func())

AtExit is used to register functions to execute before exiting.

func Exit

func Exit(code int)

Exit ensures that any registered functions are executed before exiting with the specified status code.

func InitConfig added in v0.5.0

func InitConfig(configFile string, config *client.Configuration, verbose bool, serverAddr string)

InitConfig reads in a config file and ENV variables if set. Configuration variable lookup occurs in a specific order.

func PrintErr

func PrintErr(err error)

PrintErr prints the error and then exits

func SaveConfiguration

func SaveConfiguration(c interface{}) (err error)

SaveConfiguration saves the configuration to ~/.config/amp/amp.yaml

Types

type Logger added in v0.5.0

type Logger struct {
	Verbose bool
}

Logger is a simple logger for the cli that also implements grpclog.Logger

func NewLogger added in v0.5.0

func NewLogger(verbose bool) *Logger

NewLogger creates a CLI Logger instance

func (Logger) Fatal added in v0.5.0

func (l Logger) Fatal(args ...interface{})

Fatal is equivalent to l.Print() followed by a call to os.Exit(1).

func (Logger) Fatalf added in v0.5.0

func (l Logger) Fatalf(format string, args ...interface{})

Fatalf is equivalent to l.Printf() followed by a call to os.Exit(1).

func (Logger) Fatalln added in v0.5.0

func (l Logger) Fatalln(args ...interface{})

Fatalln is equivalent to l.Println() followed by a call to os.Exit(1).

func (*Logger) Panic added in v0.5.0

func (l *Logger) Panic(v ...interface{})

Panic is equivalent to l.Print() followed by a call to panic().

func (*Logger) Panicf added in v0.5.0

func (l *Logger) Panicf(format string, v ...interface{})

Panicf is equivalent to l.Printf() followed by a call to panic().

func (*Logger) Panicln added in v0.5.0

func (l *Logger) Panicln(v ...interface{})

Panicln is equivalent to l.Println() followed by a call to panic().

func (Logger) Print added in v0.5.0

func (l Logger) Print(args ...interface{})

Print delegates to log.Print Arguments are handled in the manner of fmt.Printf.

func (Logger) Printf added in v0.5.0

func (l Logger) Printf(format string, args ...interface{})

Printf delegates to log.Printf Arguments are handled in the manner of fmt.Printf.

func (Logger) Println added in v0.5.0

func (l Logger) Println(args ...interface{})

Println delegates to log.Println Arguments are handled in the manner of fmt.Printf.

Jump to

Keyboard shortcuts

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