Documentation
¶
Index ¶
- Variables
- func Execute()
- func GetRootCommand() *cobra.Command
- type BoolFlagOpts
- type CmdContext
- func (ctx *CmdContext) Render(presentable presenters.Presentable) error
- func (ctx *CmdContext) RenderEx(presentable presenters.Presentable, options presenters.Options) error
- func (ctx *CmdContext) RenderView(views ...PresenterOption) (err error)
- func (ctx *CmdContext) RenderViewW(w io.Writer, views ...PresenterOption) error
- type CmdOption
- type CmdRunFn
- type Command
- type Initializer
- type InitializerFn
- type IntFlagOpts
- type PresenterOption
- type StringFlagOpts
- type StringSliceFlagOpts
- type TimingRequest
- type TimingResponse
Constants ¶
This section is empty.
Variables ¶
var ErrAbort = errors.New("abort")
ErrAbort - Error generated when application aborts
Functions ¶
Types ¶
type BoolFlagOpts ¶
type BoolFlagOpts struct {
Name string
Shorthand string
Description string
Default bool
EnvName string
Hidden bool
}
BoolFlagOpts - options for boolean flags
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
Verbose bool
AppName string
AppConfig *flyctl.AppConfig
}
CmdContext - context passed to commands being run
func (*CmdContext) Render ¶
func (ctx *CmdContext) Render(presentable presenters.Presentable) error
Render - Render a presentable structure via the context
func (*CmdContext) RenderEx ¶
func (ctx *CmdContext) RenderEx(presentable presenters.Presentable, options presenters.Options) error
RenderEx - Render a presentable structure via the context with additional options
func (*CmdContext) RenderView ¶
func (ctx *CmdContext) RenderView(views ...PresenterOption) (err error)
RenderView - render a view through the context to the terminal
func (*CmdContext) RenderViewW ¶
func (ctx *CmdContext) RenderViewW(w io.Writer, views ...PresenterOption) error
RenderViewW - render a view to a Writer
type CmdOption ¶
type CmdOption func(*Command) Initializer
CmdOption - A wrapper for an Initializer function that takes a command
type CmdRunFn ¶
type CmdRunFn func(*CmdContext) error
CmdRunFn - Run function for commands which takes a command context
type Command ¶
Command - Wrapper for a cobra command
func BuildCommand ¶
func BuildCommand(parent *Command, fn CmdRunFn, usageText string, shortHelpText string, longHelpText string, out io.Writer, options ...CmdOption) *Command
BuildCommand - builds a functioning Command using all the initializers
func (*Command) AddBoolFlag ¶
func (c *Command) AddBoolFlag(options BoolFlagOpts)
AddBoolFlag - Add a boolean flag for a command
func (*Command) AddCommand ¶
AddCommand adds subcommands to this command
func (*Command) AddIntFlag ¶ added in v0.0.121
func (c *Command) AddIntFlag(options IntFlagOpts)
AddIntFlag - Add an integer flag to a command
func (*Command) AddStringFlag ¶
func (c *Command) AddStringFlag(options StringFlagOpts)
AddStringFlag - Add a string flag to a command
func (*Command) AddStringSliceFlag ¶ added in v0.0.84
func (c *Command) AddStringSliceFlag(options StringSliceFlagOpts)
AddStringSliceFlag - add a string slice flag to a command
type Initializer ¶
type Initializer struct {
Setup InitializerFn
PreRun InitializerFn
}
Initializer - Retains Setup and PreRun functions
type InitializerFn ¶
type InitializerFn func(*CmdContext) error
InitializerFn - A wrapper for an Initializer function that takes a command context
type IntFlagOpts ¶ added in v0.0.121
type IntFlagOpts struct {
Name string
Shorthand string
Description string
Default int
EnvName string
Hidden bool
}
IntFlagOpts - options for integer flags
type PresenterOption ¶
type PresenterOption struct {
Presentable presenters.Presentable
Vertical bool
HideHeader bool
Title string
}
PresenterOption - options for RenderEx, RenderView, render etc...
type StringFlagOpts ¶
type StringFlagOpts struct {
Name string
Shorthand string
Description string
Default string
EnvName string
}
StringFlagOpts - options for string flags
type StringSliceFlagOpts ¶ added in v0.0.84
type StringSliceFlagOpts struct {
Name string
Shorthand string
Description string
Default []string
EnvName string
}
StringSliceFlagOpts - options a string slice flag
type TimingRequest ¶ added in v0.0.102
TimingRequest - Request to time a curl operation
type TimingResponse ¶ added in v0.0.102
type TimingResponse struct {
Err error
HTTPCode int `json:"http_code"`
SpeedDownload int `json:"speed_download"`
TimeTotal float64 `json:"time_total"`
TimeNameLookup float64 `json:"time_namelookup"`
TimeConnect float64 `json:"time_connect"`
TimePreTransfer float64 `json:"time_pretransfer"`
TimeAppConnect float64 `json:"time_appconnect"`
TimeStartTransfer float64 `json:"time_starttransfer"`
HTTPVersion string `json:"http_version"`
RemoteIP string `json:"remote_ip"`
Scheme string `json:"scheme"`
Region string `json:"region"`
}
TimingResponse - Results from timing a curl operations