mirror of https://github.com/chzyer/readline.git
improve readme
This commit is contained in:
parent
cf3342ccf3
commit
97dbc9e329
20
README.md
20
README.md
|
@ -10,6 +10,26 @@ A pure go implementation for gnu readline.
|
|||
|
||||
![demo](https://raw.githubusercontent.com/chzyer/readline/master/example/demo.gif)
|
||||
|
||||
# Usage
|
||||
|
||||
```go
|
||||
import "github.com/chzyer/readline"
|
||||
|
||||
rl, err := readline.New("> ")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer rl.Close()
|
||||
|
||||
for {
|
||||
line, err := rl.Readline()
|
||||
if err != nil { // io.EOF
|
||||
break
|
||||
}
|
||||
println(line)
|
||||
}
|
||||
```
|
||||
|
||||
# Shortcut
|
||||
|
||||
`Meta`+`B` means press `Esc` and `n` separately.
|
||||
|
|
Loading…
Reference in New Issue