ui

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2018 License: BSD-3-Clause, ISC Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultUI

type DefaultUI struct {
	cli.Ui
}

DefaultUI is an implementation of UI.

func (*DefaultUI) ErrorAPI

func (ui *DefaultUI) ErrorAPI(err error)

ErrorAPI is used for api related error messages that might appear on stderr.

func (*DefaultUI) ErrorInvalidAppPath

func (ui *DefaultUI) ErrorInvalidAppPath(arg string) int

ErrorInvalidAppPath is used for cli error related to an invalid app path

func (*DefaultUI) ErrorNoFlagAfterArg

func (ui *DefaultUI) ErrorNoFlagAfterArg(s []string) int

ErrorNoFlagAfterArg is used for cli error related to wrong argument order

func (*DefaultUI) ErrorNotEnoughArgs

func (ui *DefaultUI) ErrorNotEnoughArgs(command, help string, n int) int

ErrorNotEnoughArgs is used for cli error related to a minimum of argument.

func (*DefaultUI) Raw

func (ui *DefaultUI) Raw(v interface{}) int

Raw prints the json representation of a given struct.

func (*DefaultUI) Table

func (ui *DefaultUI) Table(kind string, v interface{})

Table prints tables depending on its given interface.

type MockUI

type MockUI struct {
	*cli.MockUi
}

MockUI is a mock UI that is used for tests and is exported publicly for use in external tests if needed as well.

func (*MockUI) ErrorAPI

func (ui *MockUI) ErrorAPI(err error)

ErrorAPI is used for api related error messages that might appear on stderr.

func (*MockUI) ErrorInvalidAppPath

func (ui *MockUI) ErrorInvalidAppPath(arg string) int

ErrorInvalidAppPath used for print error

func (*MockUI) ErrorNoFlagAfterArg

func (ui *MockUI) ErrorNoFlagAfterArg(s []string) int

ErrorNoFlagAfterArg used for print error

func (*MockUI) ErrorNotEnoughArgs

func (ui *MockUI) ErrorNotEnoughArgs(command, help string, n int) int

ErrorNotEnoughArgs is used for cli error related to a minimum of argument.

func (*MockUI) Raw

func (ui *MockUI) Raw(v interface{}) int

Raw is used for print json

func (*MockUI) Table

func (ui *MockUI) Table(kind string, v interface{})

Table is used for print a table

type UI

type UI interface {
	cli.Ui

	// ErrorAPI is used for api related error messages that might appear on
	// stderr.
	ErrorAPI(error)
	ErrorNotEnoughArgs(string, string, int) int
	ErrorInvalidAppPath(string) int
	ErrorNoFlagAfterArg([]string) int
	Table(string, interface{})
	Raw(interface{}) int
}

UI is an interface for interacting with the terminal, or "interface" of a CLI. Based on cli.Ui

func NewUI

func NewUI() UI

NewUI returns a defaultUI for interacting with the terminal. DefaultUI is prefixing errors with "error: " and colorizing errors red and info green.

Jump to

Keyboard shortcuts

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