cli

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserAgent = fmt.Sprintf(
	"Usacloud/v%s (%s/%s; +https://github.com/sacloud/usacloud) sacloud/iaas-service-go/v%s",
	version.Version,
	runtime.GOOS,
	runtime.GOARCH,
	iaas.Version,
)

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() interface{}
	IO() IO
	context.Context

	Args() []string

	PlatformName() string
	ResourceName() string
	CommandName() string

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

func NewCLIContext

func NewCLIContext(param *ContextParameter) (Context, func(), error)

type ContextParameter added in v1.8.0

type ContextParameter struct {
	PlatformName       string
	ResourceName       string
	CommandName        string
	GlobalFlags        *pflag.FlagSet
	Args               []string
	ColumnDefs         []output.ColumnDef
	Parameter          interface{}
	SkipLoadingProfile bool
}

ContextParameter CLIContext作成パラメータ

type IO

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

IO .

type ResourceContext

type ResourceContext struct {
	ID       string
	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() []string

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