command

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Name    string
	Help    string
	Type    string
	Default string
}

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 Command

type Command struct {
	Parents  []string
	Import   *imports.Import
	Name     string
	Slug     string
	Help     string
	Flags    []*Flag
	Args     []*Arg
	Subs     []*Command
	Deps     []*Dep
	Context  bool
	Runnable bool
}

func (*Command) Full

func (c *Command) Full() Full

func (*Command) Pascal

func (c *Command) Pascal() string

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
	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) Pascal

func (f Full) Pascal() string

type Generator

type Generator struct {
	Module *gomod.Module
	Parser *parser.Parser
}

TODO: rename to Command

func (*Generator) GenerateFile

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

type State

type State struct {
	Imports []*imports.Import
	// Functions []*Function
	// Structs   []*Struct
	Command *Command
}

func Load

func Load(fsys fs.FS, module *gomod.Module, parser *parser.Parser) (*State, error)

Load state

func (*State) Commands

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

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