command

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(state *State) ([]byte, error)

Types

type Arg

type Arg struct {
	Name     string
	Type     string
	Optional bool
}

func (*Arg) Method

func (a *Arg) Method() (string, error)

func (*Arg) Pascal

func (a *Arg) Pascal() string

func (*Arg) Slug

func (a *Arg) Slug() string

type Cmd

type Cmd struct {
	Parent   *Cmd
	Import   *imports.Import
	Name     string
	Help     string
	Flags    []*Flag
	Args     []*Arg
	Subs     []*Cmd
	Context  bool
	Runnable bool
}

func (*Cmd) Full

func (c *Cmd) Full() Full

func (*Cmd) Pascal

func (c *Cmd) Pascal() string

func (*Cmd) Slug

func (c *Cmd) Slug() string

type Command

type Command struct {
	// contains filtered or unexported fields
}

func New

func New(fs fs.FS, module *gomod.Module, parser *goparse.Parser) *Command

func (*Command) Compile

func (c *Command) Compile(ctx context.Context) ([]byte, error)

func (*Command) GenerateFile

func (c *Command) GenerateFile(ctx context.Context, fsys overlay.F, file *overlay.File) error

func (*Command) Parse

func (c *Command) Parse(ctx context.Context) (*State, error)

type Dep

type Dep struct {
	Import *imports.Import
	Name   string
	Type   string
}

func (*Dep) Camel

func (d *Dep) Camel() string

type Flag

type Flag struct {
	Name     string
	Help     string
	Type     string
	Default  *string
	Optional bool
	Short    byte
}

func (*Flag) Method

func (f *Flag) Method() (string, error)

func (*Flag) Pascal

func (f *Flag) Pascal() string

func (*Flag) Slug

func (f *Flag) Slug() string

type Full

type Full string

func (Full) Camel

func (f Full) Camel() string

func (Full) Pascal

func (f Full) Pascal() string

type State

type State struct {
	Imports []*imports.Import
	Command *Cmd
}

func (*State) Commands

func (s *State) Commands() []*Cmd

Flatten out the commands, intentionally ignoring the root command because that is custom generated.

Jump to

Keyboard shortcuts

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