modes

package
v0.0.0-...-a7e7b69 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MPL-2.0 Imports: 9 Imported by: 8

Documentation

Index

Constants

View Source
const (
	RETURN_TO_ROOT = "home"
	EXIT_CMD       = "exit"
	JUMP_CMD       = "j"
)

Variables

This section is empty.

Functions

func ArgAddressCheck

func ArgAddressCheck(arg string) bool

func ArgBigIntCheck

func ArgBigIntCheck(arg string) bool

func ArgBoolCheck

func ArgBoolCheck(arg string) bool

func ArgDirExistsCheck

func ArgDirExistsCheck(arg string) bool

func ArgFloatCheck

func ArgFloatCheck(arg string) bool

func ArgPubKeyHashCheck

func ArgPubKeyHashCheck(arg string) bool

func ArgTxHashCheck

func ArgTxHashCheck(arg string) bool

func ArgUInt64Check

func ArgUInt64Check(arg string) bool

func ArgsLenCheck

func ArgsLenCheck(args []string, requiredLen int) bool

func ArgsLenCheckWithOptional

func ArgsLenCheckWithOptional(args []string, requiredLen int, optionalLen int) bool

func ArgsLenCheckWithOptionalRange

func ArgsLenCheckWithOptionalRange(args []string, requiredLen int, optionalLenLower int, optionalLenHigher int) bool

func ArgsMinLenCheck

func ArgsMinLenCheck(args []string, minimumLen int) bool

func GetConfirmationInput

func GetConfirmationInput() bool

Loop to get user input for a confirmation

func PasswordCompleter

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

Returns a suggestion to ask for the user's wallet password

Types

type BaseMode

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

BaseMode handles breaking down the current input ( line ) into command and args Handles showing different suggestions depending on the command

Used as a component in other structs to statisfy the cmd interface

func (*BaseMode) CliPrefix

func (bm *BaseMode) CliPrefix() (string, bool)

Just a simple prompt prefix

func (*BaseMode) Completer

func (bm *BaseMode) Completer(d prompt.Document) []prompt.Suggest

Based on the current line, split into command and args, Pass this to the registered suggestion functions to get a specific suggestion for a command

func (*BaseMode) GetEmptySuggestions

func (bm *BaseMode) GetEmptySuggestions(line []string) []prompt.Suggest

For when there is no need for any suggestions

func (*BaseMode) HandleExitCommand

func (bm *BaseMode) HandleExitCommand(args []string)

Triggers the mcli to exit by passing back a nil instead of a valid cmd

func (*BaseMode) HandleJumpCommand

func (bm *BaseMode) HandleJumpCommand(args []string)

Updates the context's active mode based on the args provided

func (*BaseMode) HandleReturnToRoot

func (bm *BaseMode) HandleReturnToRoot(args []string)

Jumps to the root mode

func (*BaseMode) HandleSelection

func (bm *BaseMode) HandleSelection(currCmd mode_interface.Mode, selection string, args []string)

Once a selection has been made, pass args to command handler

func (*BaseMode) Init

func (bm *BaseMode) Init(contxt *context.Context)

Initializes the basemode

func (*BaseMode) RegisterCommand

func (bm *BaseMode) RegisterCommand(command string, suggestionFunc func([]string) []prompt.Suggest, commandFunc func(args []string))

func (*BaseMode) RegisterSubCommand

func (bm *BaseMode) RegisterSubCommand(command string, subcommand string, suggestionFunc func([]string) []prompt.Suggest, commandFunc func(args []string))

func (*BaseMode) SetBaseSuggestions

func (bm *BaseMode) SetBaseSuggestions(suggestions []prompt.Suggest)

type Command

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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