update readme

This commit is contained in:
Cheney 2016-02-24 22:52:02 +08:00
parent a0bb3f70e4
commit f1ecca38cc
1 changed files with 11 additions and 33 deletions

View File

@ -66,7 +66,7 @@ defer rl.Close()
for { for {
line, err := rl.Readline() line, err := rl.Readline()
if err != nil { // io.EOF if err != nil { // io.EOF, readline.ErrInterrupt
break break
} }
println(line) println(line)
@ -87,37 +87,7 @@ defer rl.Close()
for { for {
line, err := rl.Readline() line, err := rl.Readline()
if err != nil { // io.EOF if err != nil { // io.EOF, readline.ErrInterrupt
break
}
println(line)
}
```
* Example with auto refresh
```go
import (
"log"
"gopkg.in/readline.v1"
)
rl, err := readline.New("> ")
if err != nil {
panic(err)
}
defer rl.Close()
log.SetOutput(l.Stderr()) // let "log" write to l.Stderr instead of os.Stderr
go func() {
for _ = range time.Tick(time.Second) {
log.Println("hello")
}
}()
for {
line, err := rl.Readline()
if err != nil { // io.EOF
break break
} }
println(line) println(line)
@ -150,7 +120,7 @@ defer rl.Close()
for { for {
line, err := rl.Readline() line, err := rl.Readline()
if err != nil { // io.EOF if err != nil { // io.EOF, readline.ErrInterrupt
break break
} }
println(line) println(line)
@ -238,6 +208,14 @@ Notice: `Meta`+`B` is equals with `Alt`+`B` in windows.
If you test it otherwhere, whether it works fine or not, please let me know! If you test it otherwhere, whether it works fine or not, please let me know!
## Who is using Readline
* [cockroachdb/cockroach](https://github.com/cockroachdb/cockroach)
* [youtube/doorman](https://github.com/youtube/doorman)
* [bom-d-van/harp](https://github.com/bom-d-van/harp)
* [abiosoft/ishell](https://github.com/abiosoft/ishell)
* [robertkrimen/otto](https://github.com/robertkrimen/otto)
# Feedback # Feedback
If you have any questions, please submit a github issue and any pull requests is welcomed :) If you have any questions, please submit a github issue and any pull requests is welcomed :)