Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewInvalidAppSpecError ¶
NewInvalidAppSpecError creates a new error indicating that an app spec is invalid.
func NewInvalidCommandSpecError ¶
NewInvalidCommandSpecError creates a new error indicating that a command spec is invalid.
Types ¶
type App ¶
type App struct {
Name string `json:"name" yaml:"name"`
Description string `json:"description" yaml:"description"`
Server string `json:"server,omitempty" yaml:"server,omitempty"`
Auth *provider.AuthScheme `json:"auth,omitempty" yaml:"auth,omitempty"`
Commands []*Command `json:"commands" yaml:"commands"`
}
An App specifies a complete clic application.
func NewAppSpec ¶
NewAppSpec creates a new App from the provided spec.
type Command ¶
type Command struct {
Name string `json:"name" yaml:"name"`
Description string `json:"description" yaml:"description"`
Provider provider.Provider `json:"-" yaml:"-"`
Subcommands []*Command `json:"subcommands,omitempty" yaml:"subcommands,omitempty"`
}
A Command specifes an action or a set of subcommands.
func NewCommandSpec ¶
NewCommandSpec creates a new Command from the provided spec.
func (*Command) CLICommand ¶
CLICommand creates a cobra command for this command.
func (*Command) MarshalJSON ¶ added in v0.6.0
MarshalJSON marshals the command to JSON, writing the provider's config under its type key (e.g. "rest") so the result round-trips back through parsing.
func (*Command) MarshalYAML ¶ added in v0.6.0
MarshalYAML marshals the command to YAML, writing the provider's config under its type key (e.g. "rest") in a stable, human-friendly field order.
func (*Command) UnmarshalJSON ¶
UnmarshalJSON unmarshals the specified JSON data into the command.
func (*Command) UnmarshalYAML ¶
UnmarshalYAML unmarshals the specified YAML data into the command.
type Format ¶ added in v0.6.0
type Format int
Format identifies the kind of spec a document represents.
func DetectFormat ¶ added in v0.6.0
DetectFormat inspects spec content and reports whether it is an OpenAPI document or a native clic spec. OpenAPI is identified by a top-level "openapi" or "swagger" key; a clic spec by its "commands" or "name" keys.