switch readline package

This commit is contained in:
Hedy Li 2021-04-29 08:37:13 +00:00
parent ce17b98e16
commit ff5c873eed
3 changed files with 11 additions and 21 deletions

View File

@ -15,7 +15,7 @@ import (
"strconv"
"strings"
"github.com/MarekStancik/readline"
"github.com/lmorg/readline"
flag "github.com/spf13/pflag"
)
@ -328,17 +328,15 @@ func main() {
// and now here comes the line-mode prompts and stuff
rl, err := readline.New("url/cmd, ? for help > ")
if err != nil {
panic(err)
}
defer rl.Close()
rl := readline.NewInstance()
rl.SetPrompt("url/cmd, ? for help > ")
for {
line, err := rl.Readline()
if err != nil {
break
fmt.Println("error reading line input")
fmt.Println(err)
continue
}
line = strings.TrimSpace(line)
if line == "" {

2
go.mod
View File

@ -3,6 +3,6 @@ module git.sr.ht/~hedy/gelim
go 1.16
require (
github.com/MarekStancik/readline v1.5.1
github.com/lmorg/readline v0.0.0-20210316231630-be4b7d79fc3a
github.com/spf13/pflag v1.0.5
)

16
go.sum
View File

@ -1,14 +1,6 @@
github.com/MarekStancik/readline v1.5.1 h1:Aa9HEF43/ejyFuB7+09pmLolgTA/hCYq1s0eN8MPzRw=
github.com/MarekStancik/readline v1.5.1/go.mod h1:FSBlNOlfEUFxDHr1OjisxMfxSsL7zN5ReqYnee7aTYQ=
github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/nbutton23/zxcvbn-go v0.0.0-20201221231540-e56b841a3c88/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/lmorg/readline v0.0.0-20210316231630-be4b7d79fc3a h1:xiaNGfMrhqdK89RvLnc6WAe4Pe/HKaluZmipsYF3E0o=
github.com/lmorg/readline v0.0.0-20210316231630-be4b7d79fc3a/go.mod h1:DidBcghSSS00hj06CkehMGDhZ/25vZDdydkeTVUy6lY=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/testify v1.1.4/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa h1:ZYxPR6aca/uhfRJyaOAtflSHjJYiktO7QnJC5ut7iY4=
golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=