promputils

package
v0.3.9-9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 2

Documentation

Index

Constants

View Source
const BASH_COMPLETE_SCRIPT_1 = `` /* 238-byte string literal not displayed */
View Source
const BASH_COMPLETE_SCRIPT_2 = `` /* 615-byte string literal not displayed */
View Source
const ZSH_COMPLETE_SCRIPT_1 = `` /* 205-byte string literal not displayed */

Variables

This section is empty.

Functions

func AppendCommand

func AppendCommand(parentCmd *Cmd, text, desc string)

func AppendOpt

func AppendOpt(text, cmd, desc string, arg structarg.Argument)

func AppendPos

func AppendPos(text, cmd, desc string, arg structarg.Argument)

func Completer

func Completer(d prompt.Document) []prompt.Suggest

func ExecuteAndGetResult

func ExecuteAndGetResult(s string) (string, error)

func Executor

func Executor(s string)

func GenerateAutoCompleteCmds

func GenerateAutoCompleteCmds(rootCmd *Cmd, shell string) string

func InitEnv

func InitEnv(_parser *structarg.ArgumentParser, _session *mcclient.ClientSession)

Types

type Cmd

type Cmd struct {
	Name string
	Desc string

	ParentCmd *Cmd
	SubCmds   []*Cmd
	// contains filtered or unexported fields
}

func GetRootCmd

func GetRootCmd() *Cmd

func InitRootCmd

func InitRootCmd(name, desc string, optArgs, posArgs []structarg.Argument) *Cmd

func NewCmd

func NewCmd(name, desc string) *Cmd

func (*Cmd) AddCmd

func (c *Cmd) AddCmd(cmd *Cmd)

func (*Cmd) AddOptArgument

func (c *Cmd) AddOptArgument(arg structarg.Argument, argStr string, desc string)

func (*Cmd) AddPosArgument

func (c *Cmd) AddPosArgument(arg structarg.Argument, argStr string, desc string)

func (*Cmd) GenZshCompletion

func (c *Cmd) GenZshCompletion(w io.Writer) error

func (Cmd) GetArguments

func (c Cmd) GetArguments() []structarg.Argument

func (Cmd) GetName

func (c Cmd) GetName() string

func (Cmd) GetOptArguments

func (c Cmd) GetOptArguments() []structarg.Argument

func (Cmd) GetPosArguments

func (c Cmd) GetPosArguments() []structarg.Argument

func (Cmd) GetPromptOptSuggests

func (c Cmd) GetPromptOptSuggests() []prompt.Suggest

func (Cmd) GetPromptPosSuggests

func (c Cmd) GetPromptPosSuggests() []prompt.Suggest

func (*Cmd) Root

func (c *Cmd) Root() *Cmd

type CmdArgument

type CmdArgument struct {
	Suggest  prompt.Suggest
	Argument structarg.Argument
}

Jump to

Keyboard shortcuts

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