Help us shape the future of Go! Take the 2026 Go Developer Survey

shelltrix

package module
v0.0.0-...-55d2d32 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

README

Minimal wrapper for go-prompt to create a basic readliney prompt with history and configurable multilevel suggestions. Makes it quick & easy to graft a simple cmdline UI onto random small projects.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandAdd

func CommandAdd(cmd Command)

CommandAdd adds a new command to the shell

func RunShell

func RunShell()

RunShell starts the input loop and takes over executions

Types

type Command

type Command struct {
	Name        string
	Handler     CommandHandler
	Description string
	Aliases     []string
	Secondary   SecondarySuggester
	ExtraHelp   ExtraHelpText
}

Command maps commands to handlers

Required: Name, Handler, Description
Optional: Aliases, SecondarySuggester, ExtraHelp

type CommandHandler

type CommandHandler func([]string) error

CommandHandler defines the function type for handling commands

type ExtraHelpText

type ExtraHelpText func([]string) *string

ExtraHelpText defines a function for commands to produce more help text

type HelpFormatHints

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

type SecondarySuggester

type SecondarySuggester func(string) *[]prompt.Suggest

SecondarySuggester defines a function for replacing suggestions for subcommands

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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