cli

package
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Confirm

func Confirm(in util.In, msg string) bool

func ConfirmContinue

func ConfirmContinue(in util.In, target string, ids ...types.ID) bool

func FlattenErrors

func FlattenErrors(errors []error) error

func ValidateOutputOption

func ValidateOutputOption(o output.Option, defaultOutputType string) []error

func ValidateSetProhibited

func ValidateSetProhibited(fieldName string, object interface{}) []error

func WrapError

func WrapError(ctx Context, err error) error

Types

type Context

type Context interface {
	Option() *config.Config
	Output() output.Output
	Client() sacloud.APICaller
	IO() IO
	context.Context

	Args() []string

	ResourceName() string
	CommandName() string

	// WithResource 特定のリソース向け作業をする際に呼ばれる。
	// リソースのIDとゾーンを保持した新しいコンテキストを返す
	// 新しいコンテキストの親コンテキストには現在のコンテキストが設定される
	WithResource(id types.ID, zone string, resource interface{}) Context
	ID() types.ID
	Zone() string
	Resource() interface{}
}

func NewCLIContext

func NewCLIContext(resourceName, commandName string, globalFlags *pflag.FlagSet, args []string, columnDefs []output.ColumnDef, parameter interface{}, skipLoadingProfile bool) (Context, func(), error)

type IO

type IO interface {
	In() *os.File
	Out() io.Writer
	Progress() io.Writer
	Err() io.Writer
}

IO .

type ResourceContext

type ResourceContext struct {
	ID       types.ID
	Zone     string
	Resource interface{} // 対象のリソースそのもの
}

ResourceContext 現在処理中のリソースの情報

func (*ResourceContext) String

func (r *ResourceContext) String() string

type ResourceContexts

type ResourceContexts []ResourceContext

func (*ResourceContexts) Append

func (r *ResourceContexts) Append(values ...ResourceContext)

func (*ResourceContexts) IDs

func (r *ResourceContexts) IDs() []types.ID

func (*ResourceContexts) Strings

func (r *ResourceContexts) Strings() []string

Jump to

Keyboard shortcuts

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