internal

package
v0.0.0-...-c60d683 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGlobals

func SetGlobals(l ambient.AppLogger, r *requestclient.RequestClient)

SetGlobals will set the variables used by the package.

Types

type CmdBase

type CmdBase struct{}

CmdBase is a base object for structs. This reduces creating methods that are optional and provides methods all can be used.

func (*CmdBase) ArgumentSuggestions

func (c *CmdBase) ArgumentSuggestions() SmartSuggestGroup

ArgumentSuggestions returns a smart suggestion group that includes validation.

func (*CmdBase) Completer

func (c *CmdBase) Completer(d prompt.Document, args []string) []prompt.Suggest

Completer returns a list of suggestions based on the user input.

func (*CmdBase) Param

func (c *CmdBase) Param(args []string, name string) (string, error)

Param returns the named parameter value or an error if it doesn't exist.

type CmdCreateApp

type CmdCreateApp struct {
	CmdBase
}

CmdCreateApp represents a command object.

func (*CmdCreateApp) ArgumentSuggestions

func (c *CmdCreateApp) ArgumentSuggestions() SmartSuggestGroup

ArgumentSuggestions returns a smart suggestion group that includes validation.

func (*CmdCreateApp) Command

func (c *CmdCreateApp) Command() string

Command returns the initial command.

func (*CmdCreateApp) Completer

func (c *CmdCreateApp) Completer(d prompt.Document, args []string) []prompt.Suggest

Completer returns a list of suggestions based on the user input.

func (*CmdCreateApp) Executer

func (c *CmdCreateApp) Executer(args []string)

Executer executes the command.

func (*CmdCreateApp) Suggestion

func (c *CmdCreateApp) Suggestion() prompt.Suggest

Suggestion returns the suggestion for the initial command.

type CmdCreatePlugin

type CmdCreatePlugin struct {
	CmdBase
}

CmdCreatePlugin represents a command object.

func (*CmdCreatePlugin) ArgumentSuggestions

func (c *CmdCreatePlugin) ArgumentSuggestions() SmartSuggestGroup

ArgumentSuggestions returns a smart suggestion group that includes validation.

func (*CmdCreatePlugin) Command

func (c *CmdCreatePlugin) Command() string

Command returns the initial command.

func (*CmdCreatePlugin) Completer

func (c *CmdCreatePlugin) Completer(d prompt.Document, args []string) []prompt.Suggest

Completer returns a list of suggestions based on the user input.

func (*CmdCreatePlugin) Executer

func (c *CmdCreatePlugin) Executer(args []string)

Executer executes the command.

func (*CmdCreatePlugin) Suggestion

func (c *CmdCreatePlugin) Suggestion() prompt.Suggest

Suggestion returns the suggestion for the initial command.

type CmdDecrypt

type CmdDecrypt struct {
	CmdBase
}

CmdDecrypt represents a command object.

func (*CmdDecrypt) Command

func (c *CmdDecrypt) Command() string

Command returns the initial command.

func (*CmdDecrypt) Completer

func (c *CmdDecrypt) Completer(d prompt.Document, args []string) []prompt.Suggest

Completer returns a list of suggestions based on the user input.

func (*CmdDecrypt) Executer

func (c *CmdDecrypt) Executer(args []string)

Executer executes the command.

func (*CmdDecrypt) Suggestion

func (c *CmdDecrypt) Suggestion() prompt.Suggest

Suggestion returns the suggestion for the initial command.

type CmdEnable

type CmdEnable struct {
	CmdBase
}

CmdEnable represents a command object.

func (*CmdEnable) Command

func (c *CmdEnable) Command() string

Command returns the initial command.

func (*CmdEnable) Completer

func (c *CmdEnable) Completer(d prompt.Document, args []string) []prompt.Suggest

Completer returns a list of suggestions based on the user input.

func (*CmdEnable) Executer

func (c *CmdEnable) Executer(args []string)

Executer executes the command.

func (*CmdEnable) Suggestion

func (c *CmdEnable) Suggestion() prompt.Suggest

Suggestion returns the suggestion for the initial command.

type CmdEncrypt

type CmdEncrypt struct {
	CmdBase
}

CmdEncrypt represents a command object.

func (*CmdEncrypt) Command

func (c *CmdEncrypt) Command() string

Command returns the initial command.

func (*CmdEncrypt) Completer

func (c *CmdEncrypt) Completer(d prompt.Document, args []string) []prompt.Suggest

Completer returns a list of suggestions based on the user input.

func (*CmdEncrypt) Executer

func (c *CmdEncrypt) Executer(args []string)

Executer executes the command.

func (*CmdEncrypt) Suggestion

func (c *CmdEncrypt) Suggestion() prompt.Suggest

Suggestion returns the suggestion for the initial command.

type CmdExit

type CmdExit struct {
	CmdBase
}

CmdExit represents a command object.

func (*CmdExit) Checker

func (c *CmdExit) Checker(in string, breakline bool) bool

Checker returns true if exiting.

func (*CmdExit) Command

func (c *CmdExit) Command() string

Command returns the initial command.

func (*CmdExit) Executer

func (c *CmdExit) Executer(args []string)

Executer executes the command.

func (*CmdExit) Suggestion

func (c *CmdExit) Suggestion() prompt.Suggest

Suggestion returns the suggestion for the initial command.

type CmdGrant

type CmdGrant struct {
	CmdBase
}

CmdGrant represents a command object.

func (*CmdGrant) Command

func (c *CmdGrant) Command() string

Command returns the initial command.

func (*CmdGrant) Completer

func (c *CmdGrant) Completer(d prompt.Document, args []string) []prompt.Suggest

Completer returns a list of suggestions based on the user input.

func (*CmdGrant) Executer

func (c *CmdGrant) Executer(args []string)

Executer executes the command.

func (*CmdGrant) Suggestion

func (c *CmdGrant) Suggestion() prompt.Suggest

Suggestion returns the suggestion for the initial command.

type Command

type Command interface {
	Command() string
	Suggestion() prompt.Suggest
	Executer(args []string)
	Completer(d prompt.Document, args []string) []prompt.Suggest
	ArgumentSuggestions() SmartSuggestGroup
}

Command represents all the information required to run a command, including suggestions.

type CommandList

type CommandList struct {
	// contains filtered or unexported fields
}

CommandList is a collection of commands.

func NewCommandList

func NewCommandList() *CommandList

NewCommandList returns a new collection of commands.

func (*CommandList) Add

func (cl *CommandList) Add(c Command)

Add a command to the list.

func (*CommandList) Completer

func (cl *CommandList) Completer(d prompt.Document) []prompt.Suggest

Completer handles the auto completion.

func (*CommandList) Executer

func (cl *CommandList) Executer(s string)

Executer executes the typed in command.

func (*CommandList) InitialCommandSuggestions

func (cl *CommandList) InitialCommandSuggestions() []prompt.Suggest

InitialCommandSuggestions returns a list of the initial or top-level commands.

type SmartSuggest

type SmartSuggest struct {
	prompt.Suggest

	Required bool
}

SmartSuggest is an advanced struct that has additional properties.

type SmartSuggestGroup

type SmartSuggestGroup []SmartSuggest

SmartSuggestGroup is a group.

func (SmartSuggestGroup) ToSuggest

func (g SmartSuggestGroup) ToSuggest() []prompt.Suggest

ToSuggest returns an array of suggestions.

func (SmartSuggestGroup) Valid

func (g SmartSuggestGroup) Valid(list []string) (bool, string)

Valid returns true if all of the required fields are found or false with the field that is missing.

Jump to

Keyboard shortcuts

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