command

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	// Sub is map of sub commands of the current command
	// The key refer to the sub command name, and the value is it's
	// Command descriptive struct.
	Sub Commands

	// Flags is a map of flags that the command accepts.
	// The key is the flag name, and the value is it's predictions.
	Flags Flags

	// GlobalFlags is a map of flags that the command accepts.
	// Global flags that can appear also after a sub command.
	GlobalFlags Flags

	// args.Args are extra arguments that the command accepts, those who are
	// given without any flag before.
	Args predict.Predictor
}

Command represents a command line It holds the data that enables auto completion of command line Command can also be a sub command.

func (*Command) Predict

func (c *Command) Predict(a args.Args) []string

Predict returns all possible predictions for args according to the command struct

type Commands

type Commands map[string]Command

Commands is the type of Sub member, it maps a command name to a command struct

func (Commands) Predict

func (c Commands) Predict(a args.Args) (prediction []string)

Predict completion of sub command names names according to command line arguments

type Flags

type Flags map[string]predict.Predictor

Flags is the type Flags of the Flags member, it maps a flag name to the flag predictions.

func (Flags) Predict

func (f Flags) Predict(a args.Args) (prediction []string)

Predict completion of flags names according to command line arguments

Jump to

Keyboard shortcuts

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