{"id":13409970,"url":"https://github.com/c-bata/go-prompt","last_synced_at":"2025-05-12T13:18:10.865Z","repository":{"id":37850241,"uuid":"100285497","full_name":"c-bata/go-prompt","owner":"c-bata","description":"Building powerful interactive prompts in Go, inspired by python-prompt-toolkit.","archived":false,"fork":false,"pushed_at":"2024-07-14T07:08:44.000Z","size":400,"stargazers_count":5361,"open_issues_count":115,"forks_count":360,"subscribers_count":52,"default_branch":"master","last_synced_at":"2025-05-12T13:17:58.518Z","etag":null,"topics":["cli","command-line","interactive","prompt","terminal","vt100"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/c-bata/go-prompt","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/c-bata.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-08-14T16:02:09.000Z","updated_at":"2025-05-12T08:02:36.000Z","dependencies_parsed_at":"2024-04-22T03:33:02.067Z","dependency_job_id":"41175f5f-542d-4bfc-9104-1954753973ce","html_url":"https://github.com/c-bata/go-prompt","commit_stats":{"total_commits":318,"total_committers":29,"mean_commits":10.96551724137931,"dds":"0.23899371069182385","last_synced_commit":"82a912274504477990ecf7c852eebb7c85291772"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-bata%2Fgo-prompt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-bata%2Fgo-prompt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-bata%2Fgo-prompt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-bata%2Fgo-prompt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/c-bata","download_url":"https://codeload.github.com/c-bata/go-prompt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745196,"owners_count":21957319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","interactive","prompt","terminal","vt100"],"created_at":"2024-07-30T20:01:04.287Z","updated_at":"2025-05-12T13:18:10.827Z","avatar_url":"https://github.com/c-bata.png","language":"Go","funding_links":[],"categories":["Misc","HarmonyOS","命令行","语言资源库","开源类库","Go","Command Line","Open source library","Build Automation","高级控制台UI`用于构建控制台应用程序和控制台用户界面的库.`","高级控制台UI","CLI Utilities"],"sub_categories":["Windows Manager","高级控制台用户界面","go","命令行","Advanced Console UIs","Command Line","标准 CLI"],"readme":"# go-prompt\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/c-bata/go-prompt)](https://goreportcard.com/report/github.com/c-bata/go-prompt)\n![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)\n[![GoDoc](https://godoc.org/github.com/c-bata/go-prompt?status.svg)](https://godoc.org/github.com/c-bata/go-prompt) \n![tests](https://github.com/c-bata/go-prompt/workflows/tests/badge.svg)\n\nA library for building powerful interactive prompts inspired by [python-prompt-toolkit](https://github.com/jonathanslenders/python-prompt-toolkit),\nmaking it easier to build cross-platform command line tools using Go.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/c-bata/go-prompt\"\n)\n\nfunc completer(d prompt.Document) []prompt.Suggest {\n\ts := []prompt.Suggest{\n\t\t{Text: \"users\", Description: \"Store the username and age\"},\n\t\t{Text: \"articles\", Description: \"Store the article text posted by user\"},\n\t\t{Text: \"comments\", Description: \"Store the text commented to articles\"},\n\t}\n\treturn prompt.FilterHasPrefix(s, d.GetWordBeforeCursor(), true)\n}\n\nfunc main() {\n\tfmt.Println(\"Please select table.\")\n\tt := prompt.Input(\"\u003e \", completer)\n\tfmt.Println(\"You selected \" + t)\n}\n```\n\n#### Projects using go-prompt\n\n* [c-bata/kube-prompt : An interactive kubernetes client featuring auto-complete written in Go.](https://github.com/c-bata/kube-prompt)\n* [rancher/cli : The Rancher Command Line Interface (CLI)is a unified tool to manage your Rancher server](https://github.com/rancher/cli)\n* [kubicorn/kubicorn : Simple, cloud native infrastructure for Kubernetes.](https://github.com/kubicorn/kubicorn)\n* [cch123/asm-cli : Interactive shell of assembly language(X86/X64) based on unicorn and rasm2](https://github.com/cch123/asm-cli)\n* [ktr0731/evans : more expressive universal gRPC client](https://github.com/ktr0731/evans)\n* [CrushedPixel/moshpit: A Command-line tool for datamoshing.](https://github.com/CrushedPixel/moshpit)\n* [last-ent/testy-go: Testy Go: A tool for easy testing!](https://github.com/last-ent/testy-go)\n* [tiagorlampert/CHAOS: a PoC that allow generate payloads and control remote operating systems.](https://github.com/tiagorlampert/CHAOS)\n* [abs-lang/abs: ABS is a scripting language that works best on terminal. It tries to combine the elegance of languages such as Python, or Ruby, to the convenience of Bash.](https://github.com/abs-lang/abs)\n* [takashabe/btcli: btcli is a CLI client for the Bigtable. Has many read options and auto-completion.](https://github.com/takashabe/btcli)\n* [ysn2233/kafka-prompt: An interactive kafka-prompt(kafka-shell) built on existing kafka command client](https://github.com/ysn2233/kafka-prompt)\n* [fishi0x01/vsh: HashiCorp Vault interactive shell](https://github.com/fishi0x01/vsh)\n* [mstrYoda/docker-shell: A simple interactive prompt for docker](https://github.com/mstrYoda/docker-shell)\n* [c-bata/gh-prompt: An interactive GitHub CLI featuring auto-complete.](https://github.com/c-bata/gh-prompt)\n* [docker-slim/docker-slim: Don't change anything in your Docker container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)](https://github.com/docker-slim/docker-slim)\n* [rueyaa332266/ezcron: Ezcron is a CLI tool, helping you deal with cron expression easier.](https://github.com/rueyaa332266/ezcron)\n* [qingstor/qsctl: Advanced command line tool for QingStor Object Storage.](https://github.com/qingstor/qsctl)\n* [segmentio/topicctl: Tool for declarative management of Kafka topics](https://github.com/segmentio/topicctl)\n* [chriswalz/bit: Bit is a modern Git CLI](https://github.com/chriswalz/bit)\n* (If you create a CLI utility using go-prompt and want your own project to be listed here, please submit a GitHub issue.)\n\n## Features\n\n### Powerful auto-completion\n\n[![demo](https://github.com/c-bata/assets/raw/master/go-prompt/kube-prompt.gif)](https://github.com/c-bata/kube-prompt)\n\n(This is a GIF animation of kube-prompt.)\n\n### Flexible options\n\ngo-prompt provides many options. Please check [option section of GoDoc](https://godoc.org/github.com/c-bata/go-prompt#Option) for more details.\n\n[![options](https://github.com/c-bata/assets/raw/master/go-prompt/prompt-options.png)](#flexible-options)\n\n### Keyboard Shortcuts\n\nEmacs-like keyboard shortcuts are available by default (these also are the default shortcuts in Bash shell).\nYou can customize and expand these shortcuts.\n\n[![keyboard shortcuts](https://github.com/c-bata/assets/raw/master/go-prompt/keyboard-shortcuts.gif)](#keyboard-shortcuts)\n\nKey Binding          | Description\n---------------------|---------------------------------------------------------\n\u003ckbd\u003eCtrl + A\u003c/kbd\u003e  | Go to the beginning of the line (Home)\n\u003ckbd\u003eCtrl + E\u003c/kbd\u003e  | Go to the end of the line (End)\n\u003ckbd\u003eCtrl + P\u003c/kbd\u003e  | Previous command (Up arrow)\n\u003ckbd\u003eCtrl + N\u003c/kbd\u003e  | Next command (Down arrow)\n\u003ckbd\u003eCtrl + F\u003c/kbd\u003e  | Forward one character\n\u003ckbd\u003eCtrl + B\u003c/kbd\u003e  | Backward one character\n\u003ckbd\u003eCtrl + D\u003c/kbd\u003e  | Delete character under the cursor\n\u003ckbd\u003eCtrl + H\u003c/kbd\u003e  | Delete character before the cursor (Backspace)\n\u003ckbd\u003eCtrl + W\u003c/kbd\u003e  | Cut the word before the cursor to the clipboard\n\u003ckbd\u003eCtrl + K\u003c/kbd\u003e  | Cut the line after the cursor to the clipboard\n\u003ckbd\u003eCtrl + U\u003c/kbd\u003e  | Cut the line before the cursor to the clipboard\n\u003ckbd\u003eCtrl + L\u003c/kbd\u003e  | Clear the screen\n\n### History\n\nYou can use \u003ckbd\u003eUp arrow\u003c/kbd\u003e and \u003ckbd\u003eDown arrow\u003c/kbd\u003e to walk through the history of commands executed.\n\n[![History](https://github.com/c-bata/assets/raw/master/go-prompt/history.gif)](#history)\n\n### Multiple platform support\n\nWe have confirmed go-prompt works fine in the following terminals:\n\n* iTerm2 (macOS)\n* Terminal.app (macOS)\n* Command Prompt (Windows)\n* gnome-terminal (Ubuntu)\n\n## Links\n\n* [Change Log](./CHANGELOG.md)\n* [GoDoc](http://godoc.org/github.com/c-bata/go-prompt)\n* [gocover.io](https://gocover.io/github.com/c-bata/go-prompt)\n\n## Author\n\nMasashi Shibata\n\n* Twitter: [@c\\_bata\\_](https://twitter.com/c_bata_/)\n* Github: [@c-bata](https://github.com/c-bata/)\n\n## License\n\nThis software is licensed under the MIT license, see [LICENSE](./LICENSE) for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc-bata%2Fgo-prompt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fc-bata%2Fgo-prompt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc-bata%2Fgo-prompt/lists"}