liner alternatives and similar packages
Based on the "Standard CLI" category.
Alternatively, view liner alternatives based on common mentions on social networks and blogs.
-
urfave/cli
A simple, fast, and fun package for building command line apps in Go -
elvish
Elvish = Expressive Programming Language + Versatile Interactive Shell -
survey
A golang library for building interactive and accessible prompts with full support for windows and posix terminals. -
The Platinum Searcher
A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings. -
pflag
Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. -
readline
Readline is a pure go(golang) implementation for GNU-Readline kind library -
flaggy
Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies. -
wmenu
An easy to use menu structure for cli applications that prompts users to make choices. -
commandeer
Automatically sets up command line flags based on struct fields and tags. -
flag
Flag is a simple but powerful command line option parsing library for Go support infinite level subcommand -
cmdr
POSIX-compliant command-line UI (CLI) parser and Hierarchical-configuration operations -
wlog
A simple logging interface that supports cross-platform color and concurrency. -
go-getoptions
Fully featured Go (golang) command line option parser with built-in auto-completion support. -
Go-Console
GoConsole: the golang component that eases the creation of beautiful command line interfaces. -
argv
A Go library to split command line string as arguments array using the bash syntax. -
command-chain
A go library for easy configure and run command chains. Such like pipelining in unix shells.
Clean code begins in your IDE with SonarLint
Do you think we are missing an alternative of liner or a related project?
Popular Comparisons
README
Liner
Liner is a command line editor with history. It was inspired by linenoise; everything Unix-like is a VT100 (or is trying very hard to be). If your terminal is not pretending to be a VT100, change it. Liner also support Windows.
Liner is released under the X11 license (which is similar to the new BSD license).
Line Editing
The following line editing commands are supported on platforms and terminals that Liner supports:
Keystroke | Action |
---|---|
Ctrl-A, Home | Move cursor to beginning of line |
Ctrl-E, End | Move cursor to end of line |
Ctrl-B, Left | Move cursor one character left |
Ctrl-F, Right | Move cursor one character right |
Ctrl-Left, Alt-B | Move cursor to previous word |
Ctrl-Right, Alt-F | Move cursor to next word |
Ctrl-D, Del | (if line is not empty) Delete character under cursor |
Ctrl-D | (if line is empty) End of File - usually quits application |
Ctrl-C | Reset input (create new empty prompt) |
Ctrl-L | Clear screen (line is unmodified) |
Ctrl-T | Transpose previous character with current character |
Ctrl-H, BackSpace | Delete character before cursor |
Ctrl-W, Alt-BackSpace | Delete word leading up to cursor |
Alt-D | Delete word following cursor |
Ctrl-K | Delete from cursor to end of line |
Ctrl-U | Delete from start of line to cursor |
Ctrl-P, Up | Previous match from history |
Ctrl-N, Down | Next match from history |
Ctrl-R | Reverse Search history (Ctrl-S forward, Ctrl-G cancel) |
Ctrl-Y | Paste from Yank buffer (Alt-Y to paste next yank instead) |
Tab | Next completion |
Shift-Tab | (after Tab) Previous completion |
Getting started
package main
import (
"log"
"os"
"path/filepath"
"strings"
"github.com/peterh/liner"
)
var (
history_fn = filepath.Join(os.TempDir(), ".liner_example_history")
names = []string{"john", "james", "mary", "nancy"}
)
func main() {
line := liner.NewLiner()
defer line.Close()
line.SetCtrlCAborts(true)
line.SetCompleter(func(line string) (c []string) {
for _, n := range names {
if strings.HasPrefix(n, strings.ToLower(line)) {
c = append(c, n)
}
}
return
})
if f, err := os.Open(history_fn); err == nil {
line.ReadHistory(f)
f.Close()
}
if name, err := line.Prompt("What is your name? "); err == nil {
log.Print("Got: ", name)
line.AppendHistory(name)
} else if err == liner.ErrPromptAborted {
log.Print("Aborted")
} else {
log.Print("Error reading line: ", err)
}
if f, err := os.Create(history_fn); err != nil {
log.Print("Error writing history file: ", err)
} else {
line.WriteHistory(f)
f.Close()
}
}
For documentation, see http://godoc.org/github.com/peterh/liner
*Note that all licence references and agreements mentioned in the liner README section above
are relevant to that project's source code only.