mirror of https://github.com/chzyer/readline.git
Added the write method to the Instance object so that it can be passed around as a io.Writer object.
This commit is contained in:
parent
8fcf9da96c
commit
800fa3d2b8
|
@ -1,12 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/chzyer/readline"
|
||||
"github.com/traetox/readline"
|
||||
)
|
||||
|
||||
func usage(w io.Writer) {
|
||||
|
@ -43,6 +44,8 @@ func main() {
|
|||
}()
|
||||
case "bye":
|
||||
goto exit
|
||||
case "write":
|
||||
fmt.Fprintf(l, "look, i am writer too\n")
|
||||
case "":
|
||||
default:
|
||||
log.Println("you said:", strconv.Quote(line))
|
||||
|
|
|
@ -44,3 +44,7 @@ func (i *Instance) Close() error {
|
|||
i.o.Close()
|
||||
return i.t.Close()
|
||||
}
|
||||
|
||||
func (i *Instance) Write(b []byte) (int, error) {
|
||||
return i.o.Stderr().Write(b)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue