wrash

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHistory

func NewHistory(base string, w io.Writer, entries []*Entry) prompt.History

Types

type Arg added in v0.2.3

type Arg struct {
	Kind    ArgKind  `yaml:"kind"`
	Choices []string `yaml:"choices"`
	Cmd     []string `yaml:"cmd"`
}

func (*Arg) ExpectsValue added in v0.2.3

func (o *Arg) ExpectsValue() bool

func (*Arg) Suggest added in v0.2.3

func (o *Arg) Suggest(arg string) []prompt.Suggest

type ArgKind added in v0.2.3

type ArgKind string
const (
	KindDefault ArgKind = ""
	KindValue   ArgKind = "value"
	KindPath    ArgKind = "path"
	KindNone    ArgKind = "none"
)

type CommandSuggestion added in v0.2.3

type CommandSuggestion struct {
	Description string                       `yaml:"description"`
	SubCommands map[string]CommandSuggestion `yaml:"subcommands"`

	// Flags is only used to determine if a flag expects a value, or when the arg to be completed starts with a dash.
	Flags map[string]FlagSuggestion `yaml:"flags"`
	Args  Arg                       `yaml:"args"`
}

func (*CommandSuggestion) Suggest added in v0.2.3

func (s *CommandSuggestion) Suggest(args []string, completeLast bool) []prompt.Suggest

type EmptySuggestor added in v0.2.3

type EmptySuggestor struct{}

func (*EmptySuggestor) Suggest added in v0.2.3

func (s *EmptySuggestor) Suggest([]string, bool) []prompt.Suggest

type Entry

type Entry struct {
	Base string
	Cmd  string
	// contains filtered or unexported fields
}

type FlagSuggestion added in v0.2.3

type FlagSuggestion struct {
	Description string `yaml:"description"`
	Args        Arg    `yaml:"args"`
}

type Option

type Option func(*Session) error

func OptionDisablePrompt

func OptionDisablePrompt() Option

func OptionFrozen

func OptionFrozen(freeze bool) Option

func OptionHistory

func OptionHistory(h prompt.History) Option

func OptionStderr

func OptionStderr(w io.Writer) Option

func OptionStdin

func OptionStdin(r io.Reader) Option

func OptionStdout

func OptionStdout(w io.Writer) Option

func OptionSuggestor added in v0.2.3

func OptionSuggestor(suggestion Suggestor) Option

type Session

type Session struct {
	Base string
	// contains filtered or unexported fields
}

func NewSession

func NewSession(base string, opts ...Option) (*Session, error)

func (*Session) Run

func (s *Session) Run()

type Suggestor added in v0.2.3

type Suggestor interface {
	Suggest(args []string, completeLast bool) []prompt.Suggest
}

func LoadSuggestions added in v0.2.3

func LoadSuggestions(p string) (Suggestor, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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