Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultCommandCategory = &Category{ Key: "default", DisplayName: "", Order: math.MaxInt32, }
View Source
var DefaultParamCategory = &Category{ Key: "default", DisplayName: "Other options", Order: math.MaxInt32, }
View Source
var DefaultResourceCategory = &Category{ Key: "default", DisplayName: "", Order: math.MaxInt32, }
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Type CommandType Aliases []string Usage string ArgsUsage string Category string Order int Params map[string]*Schema ParamCategories []Category AltResource string // 空の場合はResourceのキーをCamelizeしてsacloud.XXXを対象とする。 ListResultFieldName string SkipAuth bool UseCustomCommand bool TableType output.OutputTableType IncludeFields []string // for output.TableDetail ExcludeFields []string // for output.TableDetail TableColumnDefines []output.ColumnDef // for output.TableSimple }
func (*Command) ParamCategory ¶
func (*Command) SortedParams ¶
func (c *Command) SortedParams() SortableParams
type CommandType ¶
type CommandType int //go:generate stringer -type=CommandType :: manual
CommandType is an enum of the type that can be represented by a schema.
const ( CommandInvalid CommandType = iota CommandList CommandCreate CommandRead CommandUpdate CommandDelete CommandManipulate // power-on/power-off CommandCustom )
func (CommandType) IsRequiredIDType ¶
func (c CommandType) IsRequiredIDType() bool
func (CommandType) String ¶
func (i CommandType) String() string
type HandlerType ¶
type HandlerType int //go:generate stringer -type=HandlerType :: manual
HandlerType is an enum of the type that can be represented by a schema.
const ( HandlerPathThrough HandlerType = iota HandlerPathThroughEach HandlerSort HandlerFilterBy HandlerAndParams HandlerOrParams HandlerCustomFunc HandlerNoop )
func (HandlerType) CanSetDestinationProp ¶
func (h HandlerType) CanSetDestinationProp() bool
CanSetDestinationProp return true when HandlerType is able to have DestinationProp
func (HandlerType) IsNeedSliceValue ¶
func (h HandlerType) IsNeedSliceValue() bool
IsNeedSliceValue return true when HandlerType is need Slice ValueType
func (HandlerType) IsWhenListOnly ¶
func (h HandlerType) IsWhenListOnly() bool
IsWhenListOnly return true when HandlerType is able to use with CommandList
func (HandlerType) String ¶
func (i HandlerType) String() string
type Resource ¶
type Resource struct { Aliases []string Usage string Commands map[string]*Command AltResource string // 空の場合はResourceのキーをCamelizeしてsacloud.XXXを対象とする。 CommandCategories []Category ResourceCategory Category }
func (*Resource) CommandCategory ¶
func (*Resource) SortedCommands ¶
func (c *Resource) SortedCommands() SortableCommands
type Schema ¶
type Schema struct { Type ValueType DefaultValue interface{} DefaultText string EnvVars []string InputDefault interface{} Aliases []string Description string // Usage -> cli Category string Order int Required bool ConflictsWith []string ValidateFunc SchemaValidateFunc MaxItems int MinItems int HandlerType HandlerType DestinationProp string CustomHandler SchemaValueHandlerFunc }
type SchemaValidateFunc ¶
type SchemaValueHandlerFunc ¶
type SchemaValueHandlerFunc func(name string, src interface{}, dest interface{})
type SortableCommand ¶
type SortableCommands ¶
type SortableCommands []SortableCommand
func (SortableCommands) Len ¶
func (s SortableCommands) Len() int
func (SortableCommands) Less ¶
func (s SortableCommands) Less(i, j int) bool
func (SortableCommands) Swap ¶
func (s SortableCommands) Swap(i, j int)
type SortableParam ¶
type SortableParams ¶
type SortableParams []SortableParam
func (SortableParams) Len ¶
func (s SortableParams) Len() int
func (SortableParams) Less ¶
func (s SortableParams) Less(i, j int) bool
func (SortableParams) Swap ¶
func (s SortableParams) Swap(i, j int)
type ValueType ¶
type ValueType int //go:generate stringer -type=ValueType :: manual
ValueType is an enum of the type that can be represented by a schema.
func (ValueType) IsSliceType ¶
IsSliceType return true if type is TypeIntList or TypeStringList
Click to show internal directories.
Click to hide internal directories.