cmdctx

package
v0.0.139 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SBEGIN = "begin"
View Source
const SDETAIL = "detail"
View Source
const SDONE = "done"
View Source
const SERROR = "error"
View Source
const SINFO = "info"
View Source
const STITLE = "title"
View Source
const SWARN = "warning"

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdContext

type CmdContext struct {
	Client       *client.Client
	Config       flyctl.Config
	GlobalConfig flyctl.Config
	NS           string
	Args         []string
	Out          io.Writer
	Terminal     *terminal.Terminal
	WorkingDir   string
	ConfigFile   string
	AppName      string
	AppConfig    *flyctl.AppConfig
}

CmdContext - context passed to commands being run

func NewCmdContext

func NewCmdContext(flyctlClient *client.Client, ns string, out io.Writer, args []string) (*CmdContext, error)

func (*CmdContext) Frender

func (commandContext *CmdContext) Frender(views ...PresenterOption) error

Frender - render a view to a Writer

func (*CmdContext) FrenderPrefix

func (commandContext *CmdContext) FrenderPrefix(prefix string, views ...PresenterOption) error

FrenderPrefix - render a view to a Writer

func (*CmdContext) OutputJSON

func (commandContext *CmdContext) OutputJSON() bool

func (*CmdContext) Render

func (commandContext *CmdContext) Render(presentable presenters.Presentable) error

Render - Render a presentable structure via the context

func (*CmdContext) Status

func (commandContext *CmdContext) Status(source string, status string, args ...interface{})

func (*CmdContext) StatusLn

func (commandContext *CmdContext) StatusLn()

func (*CmdContext) Statusf

func (commandContext *CmdContext) Statusf(source string, status string, format string, args ...interface{})

func (*CmdContext) WriteJSON

func (commandContext *CmdContext) WriteJSON(myData interface{}) error

type JSON

type JSON struct {
	TS      string
	Source  string
	Status  string
	Message string
}

type PresenterOption

type PresenterOption struct {
	Presentable presenters.Presentable
	AsJSON      bool
	Vertical    bool
	HideHeader  bool
	Title       string
}

Jump to

Keyboard shortcuts

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