session

package
v0.0.0-...-a3a871f Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2016 License: LGPL-2.1 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MESSAGE_TYPE_INFO    = "info"
	MESSAGE_TYPE_WARNING = "warning"
	MESSAGE_TYPE_ERROR   = "error"
	MESSAGE_TYPE_SUCCESS = "success"
)

Message types

Variables

This section is empty.

Functions

This section is empty.

Types

type LatchCmdSession

type LatchCmdSession struct {
	Messages []Message
	ExitCode int
}

Stores messages produced during the command run

func (*LatchCmdSession) AddError

func (session *LatchCmdSession) AddError(Content string)

Adds an error message

func (*LatchCmdSession) AddInfo

func (session *LatchCmdSession) AddInfo(Content string)

Adds an Info message

func (*LatchCmdSession) AddMessage

func (session *LatchCmdSession) AddMessage(Type string, Content string)

Adds a message

func (*LatchCmdSession) AddSuccess

func (session *LatchCmdSession) AddSuccess(Content string)

Adds a Success message

func (*LatchCmdSession) AddWarning

func (session *LatchCmdSession) AddWarning(Content string)

Adds a Warning message

func (*LatchCmdSession) End

func (session *LatchCmdSession) End()

Outputs all messages and exits with ExitCode

func (*LatchCmdSession) FormatMessageType

func (session *LatchCmdSession) FormatMessageType(messageType string) string

Colorize message types

func (*LatchCmdSession) Halt

func (session *LatchCmdSession) Halt(err error)

Prints all the messages stored in the session and halts the command execution with the provided error

func (*LatchCmdSession) Output

func (session *LatchCmdSession) Output()

Outputs messages

func (*LatchCmdSession) OutputAndExit

func (session *LatchCmdSession) OutputAndExit(output string)

Outputs a message and exits (useful to output bare information returned by the API)

type Message

type Message struct {
	Type    string
	Content string
}

Message to be printed out

Jump to

Keyboard shortcuts

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