package
0.12.0
Repository: https://github.com/sbreitf1/go-console.git
Documentation: pkg.go.dev

# Functions

DefaultOptionsPrinter returns a function that is used to print options on double-tab.
ErrCommandPanicked returns a new error that indicates a panicked command.
ErrCtrlC returns a new error that indicates user input Ctrl+C.
ErrExit returns an error that indicates a graceful CLE shutdown.
ErrUnknownCommand returns a new error that indicates an unknown command.
Escape returns a string that escapes all special chars.
GetCommandString is the inverse function of Parse() and outputs a single string equal to the given command.
IsErrCommandPanicked returns true when the error indicates a panicked command.
IsErrCtrlC returns true when the error indicates user input Ctrl+C.
IsErrExit returns true when the error indicates a graceful CLE shutdown.
IsErrUnknownCommand returns true when the error indicates an unknown command.
LocalFileSystemCompletion returns the completion options for browsing the given directory.
NeedQuote returns true when the string contains characters that need to be quoted or escaped.
NewCommandHistory returns a new command history for maxCount entries.
NewCompletionOption returns a new completion option.
NewCustomCommand returns a named command with completion and execution handler.
NewEnvironment returns a new command line environment.
NewExitCommand returns a named command to stop command line processing.
NewFixedArgCompletion returns a completion handler for a fixed set of arguments The result can directly be used as completion handler for Command definitions.
NewLabelledCompletionOption returns a new completion option with label.
NewLineHistory returns a new line history for maxCount entries.
NewLocalFileSystemArgCompletion returns a completion handler to browse the local file system.
NewOneOfArgCompletion returns a completion handler for a static list of options.
NewParameterlessCommand returns a named command that takes no parameters.
ParseCommand parses a command input with escape sequences, single quotes and double quotes.
PrepareCompletionOptions returns a list of completion options with given isPartial flag.
Quote returns a quoted string if it contains special chars.
ReadCommand reads a command from console input and offers history, aswell as completion functionality.
ReadLineWithHistory reads a line from Stdin and allows to select previous options using the Up and Down keys.

# Structs

Environment represents a command line interface environment with history and auto-completion.
ReadCommandOptions configures options and callbacks for ReadComman.

# Interfaces

ArgCompletion denotes an abstract definition for an argument in a completion chain.
Command denotes a named command with completion and execution handler.
CommandHistory defines the interface to a history of commands.
CompletionOption deontes a completion option for a command.
LineHistory defines the interface to a history of raw lines.

# Type aliases

CommandCompletionHandler describes a function that returns all completion options for a given command and entry.
CommandErrorHandler is called when a command has returned an error.
CommandHistoryHandler describes a function that returns a command from history at the given index.
ExecCommandHandler is called when processing a command.
ExecUnknownCommandHandler is called when processing an unknown command.
PrintOptionsHandler specifies a method to print options on double-tab.
PromptHandler defines a function that returns the current command line prompt.