Categorygithub.com/deadsy/go-cli
modulepackage
0.0.0-20230301174137-5c174cc4ca7e
Repository: https://github.com/deadsy/go-cli.git
Documentation: pkg.go.dev

# README

Go Report Card GoDoc

go-cli

A Go based line editor and command line interface.

The line editing code is a port of the C based linenoise library.

See: http://github.com/antirez/linenoise

The line editor can be used standalone. The CLI makes use of the line editor.

Line Editing Features

  • single line editing
  • multiline editing
  • input from files/pipes
  • input from unsupported terminals
  • history
  • completions
  • hints
  • line buffer initialization: Set an initial buffer string for editing.
  • hot keys: Set a special hot key for exiting line editing.
  • loop functions: Call a function in a loop until an exit key is pressed.

CLI Features

  • hierarchical menus
  • command tab completion
  • command history
  • context sensitive help
  • command editing

Examples

./examples/line/main.go

Matches the example code in the C version of the linenoise library.

./examples/cli/main.go

Implements an example of a heirarchical command line interface.

# Packages

No description provided by the author

# Functions

CheckArgc returns an error if the argument count is not in the valid set.
IntArg converts a number string to an integer.
NewCLI returns a new CLI object.
NewLineNoise returns a new line editor.
TableString returns a string for a table of row by column strings.
UintArg converts a number string to an unsigned integer.

# Constants

Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.
Keycodes.

# Variables

ErrQuit is returned when the user has quit line editing.
HistoryHelp is help for the history command.

# Structs

CLI stores the CLI state.
Help is a parameter help element.
Hint is used to provide hint information to the line editor.
Leaf is a leaf function within menu hierarchy.
Linenoise stores line editor state.

# Interfaces

USER is an interface for low-level UI operations.

# Type aliases

Menu is a set of menu items.
MenuItem has 3 forms: {name string, submenu Menu, description string}: reference to submenu {name string, leaf func}: leaf command with generic <cr> help {name string, leaf func, help []Help}: leaf command with specific argument help.