All Projects → c-bata → Go Prompt

c-bata / Go Prompt

Licence: mit
Building powerful interactive prompts in Go, inspired by python-prompt-toolkit.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Go Prompt

Survey
A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
Stars: ✭ 2,843 (-33.18%)
Mutual labels:  cli, command-line, prompt, interactive
Sharprompt
Interactive command line interface toolkit for C#
Stars: ✭ 197 (-95.37%)
Mutual labels:  cli, command-line, prompt, interactive
Tsukae
🧑‍💻📊 Show off your most used shell commands
Stars: ✭ 345 (-91.89%)
Mutual labels:  cli, terminal, command-line
Go Termd
Package termd provides terminal markdown rendering, with code block syntax highlighting support.
Stars: ✭ 223 (-94.76%)
Mutual labels:  cli, terminal, command-line
Teip
Select partial standard input and replace with the result of another command efficiently
Stars: ✭ 280 (-93.42%)
Mutual labels:  cli, terminal, command-line
Jmxterm
Interactive command line JMX client
Stars: ✭ 389 (-90.86%)
Mutual labels:  terminal, command-line, interactive
Csview
📠 A high performance csv viewer with cjk/emoji support.
Stars: ✭ 208 (-95.11%)
Mutual labels:  cli, terminal, command-line
Laravel Zero
A PHP framework for console artisans
Stars: ✭ 2,821 (-33.7%)
Mutual labels:  cli, terminal, command-line
Pastel
A command-line tool to generate, analyze, convert and manipulate colors
Stars: ✭ 3,742 (-12.06%)
Mutual labels:  cli, terminal, command-line
Php Console
🖥 PHP CLI application library, provide console argument parse, console controller/command run, color style, user interactive, format information show and more. 功能全面的PHP命令行应用库。提供控制台参数解析, 命令运行,颜色风格输出, 用户信息交互, 特殊格式信息显示
Stars: ✭ 310 (-92.71%)
Mutual labels:  cli, command-line, interactive
Caporal.js
A full-featured framework for building command line applications (cli) with node.js
Stars: ✭ 3,279 (-22.94%)
Mutual labels:  cli, terminal, command-line
Stonky
A command line dashboard for monitoring stocks
Stars: ✭ 208 (-95.11%)
Mutual labels:  cli, terminal, command-line
Saldl
A lightweight well-featured CLI downloader optimized for speed and early preview.
Stars: ✭ 203 (-95.23%)
Mutual labels:  cli, terminal, command-line
Kmdr Cli
🧠 The CLI tool for learning commands from your terminal
Stars: ✭ 218 (-94.88%)
Mutual labels:  cli, terminal, command-line
Ascii
👾 ASCII Roulette :: ascii art video chat on the cli
Stars: ✭ 202 (-95.25%)
Mutual labels:  cli, terminal, command-line
Jquery.terminal
jQuery Terminal Emulator - JavaScript library for creating web-based terminals with custom commands
Stars: ✭ 2,623 (-38.35%)
Mutual labels:  cli, terminal, command-line
Cmd2
cmd2 - quickly build feature-rich and user-friendly interactive command line applications in Python
Stars: ✭ 342 (-91.96%)
Mutual labels:  cli, terminal, command-line
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+3.92%)
Mutual labels:  cli, terminal, command-line
Ink
🌈 React for interactive command-line apps
Stars: ✭ 17,505 (+311.4%)
Mutual labels:  cli, command-line, interactive
Fd
A simple, fast and user-friendly alternative to 'find'
Stars: ✭ 19,851 (+366.53%)
Mutual labels:  cli, terminal, command-line

go-prompt

Go Report Card Software License GoDoc tests

A library for building powerful interactive prompts inspired by python-prompt-toolkit, making it easier to build cross-platform command line tools using Go.

package main

import (
	"fmt"
	"github.com/c-bata/go-prompt"
)

func completer(d prompt.Document) []prompt.Suggest {
	s := []prompt.Suggest{
		{Text: "users", Description: "Store the username and age"},
		{Text: "articles", Description: "Store the article text posted by user"},
		{Text: "comments", Description: "Store the text commented to articles"},
	}
	return prompt.FilterHasPrefix(s, d.GetWordBeforeCursor(), true)
}

func main() {
	fmt.Println("Please select table.")
	t := prompt.Input("> ", completer)
	fmt.Println("You selected " + t)
}

Projects using go-prompt

Features

Powerful auto-completion

demo

(This is a GIF animation of kube-prompt.)

Flexible options

go-prompt provides many options. Please check option section of GoDoc for more details.

options

Keyboard Shortcuts

Emacs-like keyboard shortcuts are available by default (these also are the default shortcuts in Bash shell). You can customize and expand these shortcuts.

keyboard shortcuts

Key Binding Description
Ctrl + A Go to the beginning of the line (Home)
Ctrl + E Go to the end of the line (End)
Ctrl + P Previous command (Up arrow)
Ctrl + N Next command (Down arrow)
Ctrl + F Forward one character
Ctrl + B Backward one character
Ctrl + D Delete character under the cursor
Ctrl + H Delete character before the cursor (Backspace)
Ctrl + W Cut the word before the cursor to the clipboard
Ctrl + K Cut the line after the cursor to the clipboard
Ctrl + U Cut the line before the cursor to the clipboard
Ctrl + L Clear the screen

History

You can use Up arrow and Down arrow to walk through the history of commands executed.

History

Multiple platform support

We have confirmed go-prompt works fine in the following terminals:

  • iTerm2 (macOS)
  • Terminal.app (macOS)
  • Command Prompt (Windows)
  • gnome-terminal (Ubuntu)

Links

Author

Masashi Shibata

License

This software is licensed under the MIT license, see LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].