suggest

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientArg

func ClientArg(prefix string) []prompt.Suggest

func ClientOrSiteArg

func ClientOrSiteArg(prefix string) []prompt.Suggest

func ClientOrSiteOrGroupArg

func ClientOrSiteOrGroupArg(prefix string) []prompt.Suggest

func DirArg

func DirArg(prefix string) []prompt.Suggest

func EnumArg

func EnumArg(prefix string, options [][2]string) []prompt.Suggest

func EnumFlagArg

func EnumFlagArg(prefix string, enumFlag *cmd.EnumFlag) []prompt.Suggest

func FileArg

func FileArg(prefix string, suffix string, dirOnly bool) []prompt.Suggest

any dir is included as it may be an intermediate dir

func InfoHashArg

func InfoHashArg(prefix string, clientName string) []prompt.Suggest

func InfoHashOrFilterArg

func InfoHashOrFilterArg(prefix string, clientName string) []prompt.Suggest

func SiteArg

func SiteArg(prefix string) []prompt.Suggest

func SiteOrGroupArg

func SiteOrGroupArg(prefix string) []prompt.Suggest

Types

type InputFlag

type InputFlag struct {
	Name  string
	Value string
	Short bool // -a or -abc style
	// a bare flag does not have value part (which means it's NOT in "--name=value" format)
	Bare bool
}

type InputingCommand

type InputingCommand struct {
	// normal (positional) args of the inputing command
	Args           []string
	MatchingPrefix string // the prefix of inputing arg or flag, could be an empty string.
	// count of positional args, excluding the last arg if it self is positional flag.
	// eg: "brush --dry-run --max-sites 10 local mteam" => 2,
	// as "brush" and "local" are positional args. last arg "mteam" also is, but is not counted.
	// "--dry-run" and "--max-sites 10" are flags.
	LastArgIndex  int64
	LastArgIsFlag bool   // if last arg is a flag
	LastArgFlag   string // the flag name of last arg
}

parsed info of current inputing ptool command

func Parse

func Parse(document *prompt.Document) *InputingCommand

parse current inputing ptool command (from start to cursor). everything after cursor is ignored. this func requires external info to discriminate whether a flag is pure or not

Jump to

Keyboard shortcuts

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