spec

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInvalidAppSpecError

func NewInvalidAppSpecError(reason string) error

NewInvalidAppSpecError creates a new error indicating that an app spec is invalid.

func NewInvalidCommandSpecError

func NewInvalidCommandSpecError(reason string) error

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"`
	Commands    []*Command `json:"commands"    yaml:"commands"`
}

An App specifies a complete clic application.

func NewAppSpec

func NewAppSpec(content []byte) (*App, error)

NewAppSpec creates a new App from the provided spec.

func (App) Validate

func (app App) Validate() error

Validate validates an App 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

func NewCommandSpec(content []byte) (*Command, error)

NewCommandSpec creates a new Command from the provided spec.

func (*Command) CLICommand

func (c *Command) CLICommand() *cobra.Command

CLICommand creates a cobra command for this command.

func (*Command) UnmarshalJSON

func (c *Command) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the specified JSON data into the command.

func (*Command) UnmarshalYAML

func (c *Command) UnmarshalYAML(data []byte) error

UnmarshalYAML unmarshals the specified YAML data into the command.

func (*Command) Validate

func (c *Command) Validate() error

Validate validates a Command spec.

Jump to

Keyboard shortcuts

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