completer

package
v0.0.0-...-f24daa0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetParamBeforeCurrent

func GetParamBeforeCurrent(args []string) string

func Init

func Init()

Types

type Command

type Command struct {
	Name        string
	Flags       []Flag
	SubCommands map[string]*Command
	Suggest     func(d prompt.Document, args []string, opts Options) []prompt.Suggest
}

func (*Command) AddCommand

func (c *Command) AddCommand(subCommand *Command)

func (*Command) AddFlag

func (c *Command) AddFlag(flag Flag)

func (*Command) Execute

func (c *Command) Execute(d prompt.Document, args []string, opts Options) []prompt.Suggest

type Completer

type Completer struct {
	RootCommand *Command
	Opts        Options
}

func CreateCompleter

func CreateCompleter(libraryfile string) Completer

func (*Completer) GetSuggestions

func (c *Completer) GetSuggestions(d prompt.Document) []prompt.Suggest

type Flag

type Flag struct {
	Name        string
	Description string
}

Framework for modeling suggestions In usage it is oriented on cobra Suggestions are modeled as commands for which they give the suggestions Execute shows if a subcommand is registered matching the first argument and then recursivly calls itself on the subcommand Otherwhise the Suggest of the current command will be called

type Options

type Options struct {
	LibraryFile string
}

Jump to

Keyboard shortcuts

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