command

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 0 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string   `yaml:"name" json:"name" jsonschema_description:"Name of the command"`
	Aliases     []string `yaml:"aliases,omitempty" json:"aliases,omitempty" jsonschema_description:"Aliases of the command"`
	Description string   `yaml:"description,omitempty" json:"description,omitempty" jsonschema_description:"Description of the command"`
	Group       string   `yaml:"group,omitempty" json:"group,omitempty" jsonschema_description:"Group of the command"`
	Hidden      bool     `yaml:"hidden,omitempty" json:"hidden,omitempty" jsonschema_description:"Hidden state of the command"`
	Parsing     Parsing  `` /* 174-byte string literal not displayed */

	Flags           map[string]string `yaml:"flags,omitempty" json:"flags,omitempty" jsonschema_description:"Flags of the command with their description"`
	PersistentFlags map[string]string `` /* 145-byte string literal not displayed */
	ExclusiveFlags  [][]string        `yaml:"exclusiveflags,omitempty" json:"exclusiveflags,omitempty" jsonschema_description:"Flags that are mutually exclusive"`
	Run             string            `yaml:"run,omitempty" json:"run,omitempty" jsonschema_description:"Command or script to execute in runnable mode"`
	Completion      struct {
		Flag          map[string][]string `yaml:"flag,omitempty" json:"flag,omitempty" jsonschema_description:"Flag completion"`
		Positional    [][]string          `yaml:"positional,omitempty" json:"positional,omitempty" jsonschema_description:"Positional completion"`
		PositionalAny []string            `` /* 133-byte string literal not displayed */
		Dash          [][]string          `yaml:"dash,omitempty" json:"dash,omitempty" jsonschema_description:"Dash completion"`
		DashAny       []string            `yaml:"dashany,omitempty" json:"dashany,omitempty" jsonschema_description:"Dash completion of every other position"`
	} `yaml:"completion,omitempty" json:"completion,omitempty" jsonschema_description:"Completion definition"`
	Commands []Command `yaml:"commands,omitempty" json:"commands,omitempty" jsonschema_description:"Subcommands of the command"`

	Documentation struct {
		Command       string            `yaml:"command,omitempty" json:"command,omitempty" jsonschema_description:"Documentation of the command"`
		Flag          map[string]string `yaml:"flag,omitempty" json:"flag,omitempty" jsonschema_description:"Documentation of flags"`
		Positional    []string          `yaml:"positional,omitempty" json:"positional,omitempty" jsonschema_description:"Documentation of positional arguments"`
		PositionalAny string            `` /* 130-byte string literal not displayed */
		Dash          []string          `yaml:"dash,omitempty" json:"dash,omitempty" jsonschema_description:"Documentation of dash arguments"`
		DashAny       string            `yaml:"dashany,omitempty" json:"dashany,omitempty" jsonschema_description:"Documentation of other dash arguments"`
	} `yaml:"documentation,omitempty" json:"documentation,omitempty" jsonschema_description:"Documentation"`
	Examples map[string]string `yaml:"examples,omitempty" json:"examples,omitempty" jsonschema_description:"Examples"`
}

func (*Command) AddFlag

func (c *Command) AddFlag(f Flag)

type Flag

type Flag struct {
	Longhand   string
	Shorthand  string
	Usage      string
	Repeatable bool
	Optarg     bool
	Value      bool
	Hidden     bool
	Required   bool
	Persistent bool
}

type Parsing

type Parsing string
const (
	DEFAULT          Parsing = ""                 // INTERSPERSED but allows implicit changes
	INTERSPERSED     Parsing = "interspersed"     // mixed flags and positional arguments
	NON_INTERSPERSED Parsing = "non-interspersed" // flag parsing stopped after first positional argument
	DISABLED         Parsing = "disabled"         // flag parsing disabled
)

Jump to

Keyboard shortcuts

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