schema

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Type        Type   `yaml:"type"`
	Variadic    bool   `yaml:"variadic"`
}

func (*Argument) Validate

func (a *Argument) Validate() error

type Command

type Command struct {
	Description string              `yaml:"description"`
	Options     map[string]*Option  `yaml:"options"`
	Arguments   []*Argument         `yaml:"arguments"`
	Subcommands map[string]*Command `yaml:"subcommands"`
}

func (*Command) Validate

func (c *Command) Validate() error

type Option

type Option struct {
	Short       string `yaml:"short"`
	Description string `yaml:"description"`
	Type        Type   `yaml:"type"`
	Default     string `yaml:"default"`
}

func (*Option) Validate

func (o *Option) Validate() error

type Program

type Program struct {
	Name        string              `yaml:"name"`
	Version     string              `yaml:"version"`
	Description string              `yaml:"description"`
	Options     map[string]*Option  `yaml:"options"`
	Arguments   []*Argument         `yaml:"arguments"`
	Subcommands map[string]*Command `yaml:"subcommands"`
}

func (*Program) Command

func (program *Program) Command() *Command

func (*Program) Validate

func (p *Program) Validate() error

type Schema

type Schema struct {
	Program Program
}

func Load

func Load(reader io.Reader) (*Schema, error)

func (*Schema) Find added in v0.0.5

func (s *Schema) Find(subcommandPath []string) *Command

func (*Schema) Save

func (s *Schema) Save(writer io.Writer) error

func (*Schema) Validate

func (s *Schema) Validate() error

func (*Schema) Walk

func (s *Schema) Walk(f func(path name.Path, cmd *Command) error) error

type Type

type Type string
const (
	TypeUnspecified Type = ""
	TypeString      Type = "string"
	TypeInteger     Type = "integer"
	TypeFloat       Type = "float"
	TypeBoolean     Type = "boolean"
)

func (Type) Validate

func (typ Type) Validate() error

Jump to

Keyboard shortcuts

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