fixed
Go to file
c-bata 62d47c3acf Refactor keybindings 2017-08-13 13:09:45 +09:00
_example Update README 2017-08-12 23:43:35 +09:00
_tools Update README 2017-08-12 23:43:35 +09:00
.gitignore Initial commit 2017-07-03 23:36:56 +09:00
LICENSE Update LICENSE 2017-07-16 13:51:31 +09:00
Makefile Rename package 2017-08-08 00:19:51 +09:00
README.md Refactor keybindings 2017-08-13 13:09:45 +09:00
bisect.go Move go files to project root 2017-07-18 05:27:57 +09:00
buffer.go Replace panic to log.Print 2017-08-06 15:21:14 +09:00
buffer_test.go Move go files to project root 2017-07-18 05:27:57 +09:00
completion.go Refactor variable names 2017-08-12 18:59:10 +09:00
completion_test.go Refactor variable names 2017-08-12 18:59:10 +09:00
console_interface.go Add refactor change 2017-08-04 16:23:18 +09:00
document.go Move go files to project root 2017-07-18 05:27:57 +09:00
document_test.go Move go files to project root 2017-07-18 05:27:57 +09:00
emacs.go Refactor keybindings 2017-08-13 13:09:45 +09:00
filter.go Add prompt.Input and prompt.Choose 2017-08-10 01:06:42 +09:00
filter_test.go Add prompt.Input and prompt.Choose 2017-08-10 01:06:42 +09:00
history.go Fix history clear 2017-08-04 20:33:28 +09:00
input.go Add prompt.Input and prompt.Choose 2017-08-10 01:06:42 +09:00
key.go Add refactor change 2017-08-04 16:23:18 +09:00
key_bind.go Refactor keybindings 2017-08-13 13:09:45 +09:00
key_string.go Move go files to project root 2017-07-18 05:27:57 +09:00
option.go Refactor keybindings 2017-08-13 13:09:45 +09:00
prompt.go Refactor keybindings 2017-08-13 13:09:45 +09:00
render.go Refactor variable names 2017-08-12 18:59:10 +09:00
render_test.go Refactor variable names 2017-08-12 18:59:10 +09:00
vt100_input.go Refactor completions 2017-08-09 21:33:47 +09:00
vt100_output.go Add flush 2017-08-11 18:24:44 +09:00

go-prompt

Library for building a powerful interactive prompt, inspired by python-prompt-toolkit. Easy building a multi-platform binary of the command line tools because built with Golang.

Similar Projects

Projects using go-prompt

Features

Powerful auto completion

demo

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

Keyboard Shortcuts

Keyboard shortcuts

You can customize keyboard shortcuts. More details are available from 'KeyBoard Shortcuts' section in Developer Guide.

Easy to use

Usage is like this:

package main

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

func completer(buf prompt.Buffer) []prompt.Suggest {
	s := []prompt.Suggest{
		{Text: "users", Description: "user table"},
		{Text: "sites", Description: "sites table"},
		{Text: "articles", Description: "articles table"},
	}
	return prompt.FilterHasPrefix(s, buf.Text(), true)
}

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

More practical example is avairable from _example directory or kube-prompt.

Flexible customization

options go-prompt has many color options. All options are listed in Developer Guide.

History

up-arrow and down-arrow to walk through the command line history.

History

Other Information

  • If you want to create projects using go-prompt, you might want to look at the Getting Started.
  • If you want to contribute go-prompt, you might want to look at the Developer Guide.
  • If you want to know internal API, you might want to look at the GoDoc.

Author

Masashi Shibata

LICENSE

This software is licensed under the MIT License (See LICENSE ).