在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:c-bata/go-prompt开源软件地址:https://github.com/c-bata/go-prompt开源编程语言:Go 98.8%开源软件介绍:go-promptA 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
FeaturesPowerful auto-completion(This is a GIF animation of kube-prompt.) Flexible optionsgo-prompt provides many options. Please check option section of GoDoc for more details. Keyboard ShortcutsEmacs-like keyboard shortcuts are available by default (these also are the default shortcuts in Bash shell). You can customize and expand these shortcuts.
HistoryYou can use Up arrow and Down arrow to walk through the history of commands executed. Multiple platform supportWe have confirmed go-prompt works fine in the following terminals:
LinksAuthorMasashi Shibata LicenseThis software is licensed under the MIT license, see LICENSE for more information. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论