mirror of https://github.com/chzyer/readline.git
remove unused files
This commit is contained in:
parent
f533ef1caa
commit
bc5c91eb5b
|
@ -1,2 +0,0 @@
|
|||
*.exe
|
||||
*.tmp
|
36
char.go
36
char.go
|
@ -1,36 +0,0 @@
|
|||
package readline
|
||||
|
||||
const (
|
||||
CharLineStart = 1
|
||||
CharBackward = 2
|
||||
CharInterrupt = 3
|
||||
CharDelete = 4
|
||||
CharLineEnd = 5
|
||||
CharForward = 6
|
||||
CharBell = 7
|
||||
CharCtrlH = 8
|
||||
CharTab = 9
|
||||
CharCtrlJ = 10
|
||||
CharKill = 11
|
||||
CharCtrlL = 12
|
||||
CharEnter = 13
|
||||
CharNext = 14
|
||||
CharPrev = 16
|
||||
CharBckSearch = 18
|
||||
CharFwdSearch = 19
|
||||
CharTranspose = 20
|
||||
CharCtrlU = 21
|
||||
CharCtrlW = 23
|
||||
CharCtrlZ = 26
|
||||
CharEsc = 27
|
||||
CharEscapeEx = 91
|
||||
CharBackspace = 127
|
||||
)
|
||||
|
||||
const (
|
||||
MetaBackward rune = -iota - 1
|
||||
MetaForward
|
||||
MetaDelete
|
||||
MetaBackspace
|
||||
MetaTranspose
|
||||
)
|
|
@ -18,6 +18,12 @@ type AutoCompleter interface {
|
|||
Do(line []rune, pos int) (newLine [][]rune, length int)
|
||||
}
|
||||
|
||||
type TabCompleter struct{}
|
||||
|
||||
func (t *TabCompleter) Do([]rune, int) ([][]rune, int) {
|
||||
return [][]rune{[]rune("\t")}, 0
|
||||
}
|
||||
|
||||
type opCompleter struct {
|
||||
w io.Writer
|
||||
op *Operation
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
package readline
|
||||
|
||||
type TabCompleter struct{}
|
||||
|
||||
func (t *TabCompleter) Do([]rune, int) ([][]rune, int) {
|
||||
return [][]rune{[]rune("\t")}, 0
|
||||
}
|
29
debug.go
29
debug.go
|
@ -1,29 +0,0 @@
|
|||
package readline
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func sleep(n int) {
|
||||
Debug(n)
|
||||
time.Sleep(2000 * time.Millisecond)
|
||||
}
|
||||
|
||||
// print a linked list to Debug()
|
||||
func debugList(l *list.List) {
|
||||
idx := 0
|
||||
for e := l.Front(); e != nil; e = e.Next() {
|
||||
Debug(idx, fmt.Sprintf("%+v", e.Value))
|
||||
idx++
|
||||
}
|
||||
}
|
||||
|
||||
// append log info to another file
|
||||
func Debug(o ...interface{}) {
|
||||
f, _ := os.OpenFile("debug.tmp", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
fmt.Fprintln(f, o...)
|
||||
f.Close()
|
||||
}
|
20
doc.go
20
doc.go
|
@ -1,20 +0,0 @@
|
|||
// Readline is a pure go implementation for GNU-Readline kind library.
|
||||
//
|
||||
// WHY: Readline will support most of features which GNU Readline is supported, and provide a pure go environment and a MIT license.
|
||||
//
|
||||
// example:
|
||||
// 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)
|
||||
// }
|
||||
//
|
||||
package readline
|
17
readline.go
17
readline.go
|
@ -1,3 +1,20 @@
|
|||
// Readline is a pure go implementation for GNU-Readline kind library.
|
||||
//
|
||||
// example:
|
||||
// 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)
|
||||
// }
|
||||
//
|
||||
package readline
|
||||
|
||||
import "io"
|
||||
|
|
61
utils.go
61
utils.go
|
@ -3,6 +3,9 @@ package readline
|
|||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"container/list"
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -14,6 +17,41 @@ var (
|
|||
isWindows = false
|
||||
)
|
||||
|
||||
const (
|
||||
CharLineStart = 1
|
||||
CharBackward = 2
|
||||
CharInterrupt = 3
|
||||
CharDelete = 4
|
||||
CharLineEnd = 5
|
||||
CharForward = 6
|
||||
CharBell = 7
|
||||
CharCtrlH = 8
|
||||
CharTab = 9
|
||||
CharCtrlJ = 10
|
||||
CharKill = 11
|
||||
CharCtrlL = 12
|
||||
CharEnter = 13
|
||||
CharNext = 14
|
||||
CharPrev = 16
|
||||
CharBckSearch = 18
|
||||
CharFwdSearch = 19
|
||||
CharTranspose = 20
|
||||
CharCtrlU = 21
|
||||
CharCtrlW = 23
|
||||
CharCtrlZ = 26
|
||||
CharEsc = 27
|
||||
CharEscapeEx = 91
|
||||
CharBackspace = 127
|
||||
)
|
||||
|
||||
const (
|
||||
MetaBackward rune = -iota - 1
|
||||
MetaForward
|
||||
MetaDelete
|
||||
MetaBackspace
|
||||
MetaTranspose
|
||||
)
|
||||
|
||||
// WaitForResume need to call before current process got suspend.
|
||||
// It will run a ticker until a long duration is occurs,
|
||||
// which means this process is resumed.
|
||||
|
@ -211,3 +249,26 @@ func (r *RawMode) Exit() error {
|
|||
}
|
||||
return Restore(GetStdin(), r.state)
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
func sleep(n int) {
|
||||
Debug(n)
|
||||
time.Sleep(2000 * time.Millisecond)
|
||||
}
|
||||
|
||||
// print a linked list to Debug()
|
||||
func debugList(l *list.List) {
|
||||
idx := 0
|
||||
for e := l.Front(); e != nil; e = e.Next() {
|
||||
Debug(idx, fmt.Sprintf("%+v", e.Value))
|
||||
idx++
|
||||
}
|
||||
}
|
||||
|
||||
// append log info to another file
|
||||
func Debug(o ...interface{}) {
|
||||
f, _ := os.OpenFile("debug.tmp", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
fmt.Fprintln(f, o...)
|
||||
f.Close()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue