Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time
March 2, 2021 02:56
December 18, 2018 03:13
March 3, 2021 10:40
July 16, 2017 13:51
September 19, 2020 00:06
February 28, 2020 16:50
February 19, 2018 23:26
February 24, 2020 14:13
March 3, 2021 10:40
March 3, 2021 10:40
February 14, 2018 01:14
December 18, 2018 03:13
December 18, 2018 03:13
December 18, 2018 03:13
December 14, 2018 22:34
October 20, 2018 13:49
February 24, 2020 14:13
February 24, 2020 14:13
February 24, 2020 14:13


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 (

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


Powerful auto-completion


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

Flexible options

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


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


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


Multiple platform support

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

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



Masashi Shibata


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