cmdctx

package
v0.0.483-pre-2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdContext

type CmdContext struct {
	IO            *iostreams.IOStreams
	Client        *client.Client
	Config        flyctl.Config
	GlobalConfig  flyctl.Config
	NS            string
	Args          []string
	Command       *cobra.Command
	Out           io.Writer
	WorkingDir    string
	ConfigFile    string
	AppName       string
	AppConfig     *flyctl.AppConfig
	MachineConfig *api.MachineConfig
}

CmdContext - context passed to commands being run

func NewCmdContext

func NewCmdContext(flyctlClient *client.Client, ns string, cmd *cobra.Command, 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{})

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