cmd

package
v0.0.98 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAbort = errors.New("abort")

Functions

func Execute

func Execute()

func GetRootCommand

func GetRootCommand() *cobra.Command

Types

type BoolFlagOpts

type BoolFlagOpts struct {
	Name        string
	Shorthand   string
	Description string
	Default     bool
	EnvName     string
}

type CmdContext

type CmdContext struct {
	Config       flyctl.Config
	GlobalConfig flyctl.Config
	NS           string
	Args         []string
	Out          io.Writer
	FlyClient    *api.Client
	Terminal     *terminal.Terminal
	WorkingDir   string
	ConfigFile   string

	AppName   string
	AppConfig *flyctl.AppConfig
}

func (*CmdContext) InitApiClient

func (ctx *CmdContext) InitApiClient() error

func (*CmdContext) Render

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

func (*CmdContext) RenderEx

func (ctx *CmdContext) RenderEx(presentable presenters.Presentable, options presenters.Options) error

func (*CmdContext) RenderView

func (ctx *CmdContext) RenderView(views ...PresenterOption) (err error)

func (*CmdContext) RenderViewW

func (ctx *CmdContext) RenderViewW(w io.Writer, views ...PresenterOption) error

type CmdOption

type CmdOption func(*Command) Initializer

type CmdRunFn

type CmdRunFn func(*CmdContext) error

type Command

type Command struct {
	*cobra.Command
	// contains filtered or unexported fields
}

func BuildCommand

func BuildCommand(parent *Command, fn CmdRunFn, usageText string, shortHelpText string, longHelpText string, initClient bool, out io.Writer, options ...CmdOption) *Command

func (*Command) AddBoolFlag

func (c *Command) AddBoolFlag(options BoolFlagOpts)

func (*Command) AddCommand

func (c *Command) AddCommand(commands ...*Command)

AddCommand adds subcommands to this command

func (*Command) AddStringFlag

func (c *Command) AddStringFlag(options StringFlagOpts)

func (*Command) AddStringSliceFlag added in v0.0.84

func (c *Command) AddStringSliceFlag(options StringSliceFlagOpts)

type Initializer

type Initializer struct {
	Setup  InitializerFn
	PreRun InitializerFn
}

type InitializerFn

type InitializerFn func(*CmdContext) error

type PresenterOption

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

type StringFlagOpts

type StringFlagOpts struct {
	Name        string
	Shorthand   string
	Description string
	Default     string
	EnvName     string
}

type StringSliceFlagOpts added in v0.0.84

type StringSliceFlagOpts struct {
	Name        string
	Shorthand   string
	Description string
	Default     []string
	EnvName     string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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