diff --git a/LICENSE b/LICENSE index a86acaa7..cb7078f6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,6 @@ MIT License +Copyright (c) 2023 Mateusz Drewniak Copyright (c) 2017 Masashi SHIBATA Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/README.md b/README.md index cfcd7a39..19ea9d0f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,16 @@ # go-prompt -[![Go Report Card](https://goreportcard.com/badge/github.com/c-bata/go-prompt)](https://goreportcard.com/report/github.com/c-bata/go-prompt) +[![Go Report Card](https://goreportcard.com/badge/github.com/elk-language/go-prompt)](https://goreportcard.com/report/github.com/elk-language/go-prompt) ![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square) -[![GoDoc](https://godoc.org/github.com/c-bata/go-prompt?status.svg)](https://godoc.org/github.com/c-bata/go-prompt) -![tests](https://github.com/c-bata/go-prompt/workflows/tests/badge.svg) +[![GoDoc](https://godoc.org/github.com/elk-language/go-prompt?status.svg)](https://godoc.org/github.com/elk-language/go-prompt) +![tests](https://github.com/elk-language/go-prompt/workflows/tests/badge.svg) + +This is a fork of [c-bata/go-prompt](https://github.com/c-bata/go-prompt). +It's a great library but it's been abandoned +for quite a while. +This project aims to continue its development. + +--- A library for building powerful interactive prompts inspired by [python-prompt-toolkit](https://github.com/jonathanslenders/python-prompt-toolkit), making it easier to build cross-platform command line tools using Go. @@ -13,7 +20,7 @@ package main import ( "fmt" - "github.com/c-bata/go-prompt" + "github.com/elk-language/go-prompt" ) func completer(d prompt.Document) []prompt.Suggest { @@ -32,29 +39,6 @@ func main() { } ``` -#### Projects using go-prompt - -* [c-bata/kube-prompt : An interactive kubernetes client featuring auto-complete written in Go.](https://github.com/c-bata/kube-prompt) -* [rancher/cli : The Rancher Command Line Interface (CLI)is a unified tool to manage your Rancher server](https://github.com/rancher/cli) -* [kubicorn/kubicorn : Simple, cloud native infrastructure for Kubernetes.](https://github.com/kubicorn/kubicorn) -* [cch123/asm-cli : Interactive shell of assembly language(X86/X64) based on unicorn and rasm2](https://github.com/cch123/asm-cli) -* [ktr0731/evans : more expressive universal gRPC client](https://github.com/ktr0731/evans) -* [CrushedPixel/moshpit: A Command-line tool for datamoshing.](https://github.com/CrushedPixel/moshpit) -* [last-ent/testy-go: Testy Go: A tool for easy testing!](https://github.com/last-ent/testy-go) -* [tiagorlampert/CHAOS: a PoC that allow generate payloads and control remote operating systems.](https://github.com/tiagorlampert/CHAOS) -* [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) -* [takashabe/btcli: btcli is a CLI client for the Bigtable. Has many read options and auto-completion.](https://github.com/takashabe/btcli) -* [ysn2233/kafka-prompt: An interactive kafka-prompt(kafka-shell) built on existing kafka command client](https://github.com/ysn2233/kafka-prompt) -* [fishi0x01/vsh: HashiCorp Vault interactive shell](https://github.com/fishi0x01/vsh) -* [mstrYoda/docker-shell: A simple interactive prompt for docker](https://github.com/mstrYoda/docker-shell) -* [c-bata/gh-prompt: An interactive GitHub CLI featuring auto-complete.](https://github.com/c-bata/gh-prompt) -* [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) -* [rueyaa332266/ezcron: Ezcron is a CLI tool, helping you deal with cron expression easier.](https://github.com/rueyaa332266/ezcron) -* [qingstor/qsctl: Advanced command line tool for QingStor Object Storage.](https://github.com/qingstor/qsctl) -* [segmentio/topicctl: Tool for declarative management of Kafka topics](https://github.com/segmentio/topicctl) -* [chriswalz/bit: Bit is a modern Git CLI](https://github.com/chriswalz/bit) -* (If you create a CLI utility using go-prompt and want your own project to be listed here, please submit a GitHub issue.) - ## Features ### Powerful auto-completion @@ -65,7 +49,7 @@ func main() { ### Flexible options -go-prompt provides many options. Please check [option section of GoDoc](https://godoc.org/github.com/c-bata/go-prompt#Option) for more details. +go-prompt provides many options. Please check [option section of GoDoc](https://godoc.org/github.com/elk-language/go-prompt#Option) for more details. [![options](https://github.com/c-bata/assets/raw/master/go-prompt/prompt-options.png)](#flexible-options) @@ -109,17 +93,16 @@ We have confirmed go-prompt works fine in the following terminals: ## Links * [Change Log](./CHANGELOG.md) -* [GoDoc](http://godoc.org/github.com/c-bata/go-prompt) -* [gocover.io](https://gocover.io/github.com/c-bata/go-prompt) +* [GoDoc](http://godoc.org/github.com/elk-language/go-prompt) +* [gocover.io](https://gocover.io/github.com/elk-language/go-prompt) + +## License + +This software is licensed under the MIT license, see [LICENSE](./LICENSE) for more information. -## Author +## Original Author Masashi Shibata * Twitter: [@c\_bata\_](https://twitter.com/c_bata_/) * Github: [@c-bata](https://github.com/c-bata/) - -## License - -This software is licensed under the MIT license, see [LICENSE](./LICENSE) for more information. - diff --git a/_example/even-lexer/main.go b/_example/even-lexer/main.go index 836ac57d..9f158ce5 100644 --- a/_example/even-lexer/main.go +++ b/_example/even-lexer/main.go @@ -2,8 +2,9 @@ package main import ( "fmt" - "github.com/c-bata/go-prompt" "strings" + + "github.com/elk-language/go-prompt" ) func main() { diff --git a/_example/exec-command/main.go b/_example/exec-command/main.go index 838f7562..58de271d 100644 --- a/_example/exec-command/main.go +++ b/_example/exec-command/main.go @@ -4,7 +4,7 @@ import ( "os" "os/exec" - prompt "github.com/c-bata/go-prompt" + prompt "github.com/elk-language/go-prompt" ) func executor(t string) { diff --git a/_example/http-prompt/main.go b/_example/http-prompt/main.go index b372a355..2824a22e 100644 --- a/_example/http-prompt/main.go +++ b/_example/http-prompt/main.go @@ -10,7 +10,7 @@ import ( "path" "strings" - prompt "github.com/c-bata/go-prompt" + prompt "github.com/elk-language/go-prompt" ) type RequestContext struct { diff --git a/_example/live-prefix/main.go b/_example/live-prefix/main.go index 9c7ced72..8a457dfa 100644 --- a/_example/live-prefix/main.go +++ b/_example/live-prefix/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - prompt "github.com/c-bata/go-prompt" + prompt "github.com/elk-language/go-prompt" ) var LivePrefixState struct { diff --git a/_example/simple-echo/cjk-cyrillic/main.go b/_example/simple-echo/cjk-cyrillic/main.go index 3e9e53ad..27309723 100644 --- a/_example/simple-echo/cjk-cyrillic/main.go +++ b/_example/simple-echo/cjk-cyrillic/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - prompt "github.com/c-bata/go-prompt" + prompt "github.com/elk-language/go-prompt" ) func executor(in string) { diff --git a/_example/simple-echo/main.go b/_example/simple-echo/main.go index 12b1bb4f..3330c0fc 100644 --- a/_example/simple-echo/main.go +++ b/_example/simple-echo/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - prompt "github.com/c-bata/go-prompt" + prompt "github.com/elk-language/go-prompt" ) func completer(in prompt.Document) []prompt.Suggest { diff --git a/_tools/complete_file/main.go b/_tools/complete_file/main.go index 41015cfa..0d7cb9fe 100644 --- a/_tools/complete_file/main.go +++ b/_tools/complete_file/main.go @@ -5,8 +5,8 @@ import ( "os" "strings" - prompt "github.com/c-bata/go-prompt" - "github.com/c-bata/go-prompt/completer" + prompt "github.com/elk-language/go-prompt" + "github.com/elk-language/go-prompt/completer" ) var filePathCompleter = completer.FilePathCompleter{ diff --git a/_tools/vt100_debug/main.go b/_tools/vt100_debug/main.go index c6036d45..9dc6a483 100644 --- a/_tools/vt100_debug/main.go +++ b/_tools/vt100_debug/main.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package main @@ -6,8 +7,8 @@ import ( "fmt" "syscall" - prompt "github.com/c-bata/go-prompt" - "github.com/c-bata/go-prompt/internal/term" + prompt "github.com/elk-language/go-prompt" + "github.com/elk-language/go-prompt/internal/term" ) func main() { diff --git a/buffer.go b/buffer.go index aa119b57..996af7c3 100644 --- a/buffer.go +++ b/buffer.go @@ -3,7 +3,7 @@ package prompt import ( "strings" - "github.com/c-bata/go-prompt/internal/debug" + "github.com/elk-language/go-prompt/internal/debug" ) // Buffer emulates the console buffer. @@ -49,7 +49,7 @@ func (b *Buffer) InsertText(v string, overwrite bool, moveCursor bool) { if overwrite { overwritten := string(or[oc:]) if len(overwritten) >= oc+len(v) { - overwritten = string(or[oc : oc+len(v)]) + overwritten = string(or[oc : oc+len(v)]) } if strings.Contains(overwritten, "\n") { i := strings.IndexAny(overwritten, "\n") diff --git a/completer/file.go b/completer/file.go index 59f2d8de..1b7a544a 100644 --- a/completer/file.go +++ b/completer/file.go @@ -7,8 +7,8 @@ import ( "path/filepath" "runtime" - prompt "github.com/c-bata/go-prompt" - "github.com/c-bata/go-prompt/internal/debug" + prompt "github.com/elk-language/go-prompt" + "github.com/elk-language/go-prompt/internal/debug" ) var ( diff --git a/completion.go b/completion.go index 0ae50f21..69183dbd 100644 --- a/completion.go +++ b/completion.go @@ -3,7 +3,7 @@ package prompt import ( "strings" - "github.com/c-bata/go-prompt/internal/debug" + "github.com/elk-language/go-prompt/internal/debug" runewidth "github.com/mattn/go-runewidth" ) diff --git a/document.go b/document.go index 2a47f52b..b1996455 100644 --- a/document.go +++ b/document.go @@ -4,8 +4,8 @@ import ( "strings" "unicode/utf8" - "github.com/c-bata/go-prompt/internal/bisect" - istrings "github.com/c-bata/go-prompt/internal/strings" + "github.com/elk-language/go-prompt/internal/bisect" + istrings "github.com/elk-language/go-prompt/internal/strings" runewidth "github.com/mattn/go-runewidth" ) diff --git a/document_test.go b/document_test.go index 9f273b7b..dd4d1022 100644 --- a/document_test.go +++ b/document_test.go @@ -242,7 +242,7 @@ func TestDocument_DisplayCursorPosition(t *testing.T) { // If you're facing test failure on this test case and your terminal is iTerm2, // please check 'Profile -> Text' configuration. 'Use Unicode version 9 widths' // must be checked. - // https://github.com/c-bata/go-prompt/pull/99 + // https://github.com/elk-language/go-prompt/pull/99 document: &Document{ Text: "Добрый день", cursorPosition: 3, diff --git a/emacs.go b/emacs.go index ed9d813b..636606bd 100644 --- a/emacs.go +++ b/emacs.go @@ -1,6 +1,6 @@ package prompt -import "github.com/c-bata/go-prompt/internal/debug" +import "github.com/elk-language/go-prompt/internal/debug" /* diff --git a/go.mod b/go.mod index 30bc6d39..3ee29a32 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/c-bata/go-prompt +module github.com/elk-language/go-prompt go 1.14 diff --git a/input_posix.go b/input_posix.go index 6a7e8187..afaa3dc0 100644 --- a/input_posix.go +++ b/input_posix.go @@ -7,7 +7,7 @@ import ( "os" "syscall" - "github.com/c-bata/go-prompt/internal/term" + "github.com/elk-language/go-prompt/internal/term" "golang.org/x/sys/unix" ) diff --git a/internal/bisect/bisect_test.go b/internal/bisect/bisect_test.go index 9d52a298..51a62452 100644 --- a/internal/bisect/bisect_test.go +++ b/internal/bisect/bisect_test.go @@ -5,7 +5,7 @@ import ( "math/rand" "testing" - "github.com/c-bata/go-prompt/internal/bisect" + "github.com/elk-language/go-prompt/internal/bisect" ) func Example() { diff --git a/internal/strings/strings_test.go b/internal/strings/strings_test.go index d9d9bc9c..9782da0c 100644 --- a/internal/strings/strings_test.go +++ b/internal/strings/strings_test.go @@ -3,7 +3,7 @@ package strings_test import ( "fmt" - "github.com/c-bata/go-prompt/internal/strings" + "github.com/elk-language/go-prompt/internal/strings" ) func ExampleIndexNotByte() { diff --git a/output_vt100.go b/output_vt100.go index 20850fea..894b858e 100644 --- a/output_vt100.go +++ b/output_vt100.go @@ -214,7 +214,7 @@ func (w *VT100Writer) SetColor(fg, bg Color, bold bool) { w.SetDisplayAttributes(fg, bg, DisplayBold) } else { // If using `DisplayDefualt`, it will be broken in some environment. - // Details are https://github.com/c-bata/go-prompt/pull/85 + // Details are https://github.com/elk-language/go-prompt/pull/85 w.SetDisplayAttributes(fg, bg, DisplayReset) } } diff --git a/prompt.go b/prompt.go index 5427917d..00dd3240 100644 --- a/prompt.go +++ b/prompt.go @@ -7,7 +7,7 @@ import ( "unicode" "unicode/utf8" - "github.com/c-bata/go-prompt/internal/debug" + "github.com/elk-language/go-prompt/internal/debug" ) // Executor is called when the user diff --git a/render.go b/render.go index 7e83f0c8..00f5c055 100644 --- a/render.go +++ b/render.go @@ -4,7 +4,7 @@ import ( "runtime" "strings" - "github.com/c-bata/go-prompt/internal/debug" + "github.com/elk-language/go-prompt/internal/debug" runewidth "github.com/mattn/go-runewidth" ) diff --git a/signal_posix.go b/signal_posix.go index f3150df5..fe27a99a 100644 --- a/signal_posix.go +++ b/signal_posix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package prompt @@ -7,7 +8,7 @@ import ( "os/signal" "syscall" - "github.com/c-bata/go-prompt/internal/debug" + "github.com/elk-language/go-prompt/internal/debug" ) func (p *Prompt) handleSignals(exitCh chan int, winSizeCh chan *WinSize, stop chan struct{}) { diff --git a/signal_windows.go b/signal_windows.go index 3a427c79..2b79c39c 100644 --- a/signal_windows.go +++ b/signal_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package prompt @@ -7,7 +8,7 @@ import ( "os/signal" "syscall" - "github.com/c-bata/go-prompt/internal/debug" + "github.com/elk-language/go-prompt/internal/debug" ) func (p *Prompt) handleSignals(exitCh chan int, winSizeCh chan *WinSize, stop chan struct{}) {