mirror of
https://github.com/wader/fq.git
synced 2024-11-21 23:04:07 +03:00
readline: Switch to ergochat/readline
All fq changes merged.
This commit is contained in:
parent
569bd615f5
commit
41226f48d8
6
Makefile
6
Makefile
@ -77,7 +77,6 @@ cpuprof: prof
|
||||
go tool pprof -http :5555 fq.prof fq.cpu.prof
|
||||
|
||||
update-gomod: always
|
||||
GOPROXY=direct go get -d github.com/wader/readline@fq
|
||||
GOPROXY=direct go get -d github.com/wader/gojq@fq
|
||||
go mod tidy
|
||||
|
||||
@ -98,7 +97,6 @@ fuzz: always
|
||||
# tag forked dependeces for history and to make then stay around
|
||||
release: always
|
||||
release: WADER_GOJQ_COMMIT=$(shell go list -m -f '{{.Version}}' github.com/wader/gojq | sed 's/.*-\(.*\)/\1/')
|
||||
release: WADER_READLINE_COMMIT=$(shell go list -m -f '{{.Version}}' github.com/wader/readline | sed 's/.*-\(.*\)/\1/')
|
||||
release:
|
||||
@echo "# wader/fq":
|
||||
@echo "# make sure head is at wader/master"
|
||||
@ -121,10 +119,6 @@ release:
|
||||
@echo git tag fq-v${VERSION} ${WADER_GOJQ_COMMIT}
|
||||
@echo git push wader fq-v${VERSION}:fq-v${VERSION}
|
||||
@echo
|
||||
@echo "# wader/readline:"
|
||||
@echo git tag fq-v${VERSION} ${WADER_READLINE_COMMIT}
|
||||
@echo git push wader fq-v${VERSION}:fq-v${VERSION}
|
||||
@echo
|
||||
@echo "# wader/fq":
|
||||
@echo git push wader v${VERSION}:v${VERSION}
|
||||
@echo "# edit draft release notes and publish"
|
||||
|
@ -311,7 +311,7 @@ See the [LICENSE](LICENSE) file for license details.
|
||||
Licenses of direct dependencies:
|
||||
|
||||
- Forked version of gojq - https://github.com/itchyny/gojq/blob/main/LICENSE (MIT)
|
||||
- Forked version of readline - https://github.com/chzyer/readline/blob/master/LICENSE (MIT)
|
||||
- github.com/ergochat/readline - https://github.com/ergochat/readline/blob/master/LICENSE (MIT)
|
||||
- github.com/BurntSushi/toml - https://github.com/BurntSushi/toml/blob/master/COPYING (MIT)
|
||||
- github.com/creasty/defaults - https://github.com/creasty/defaults/blob/master/LICENSE (MIT)
|
||||
- github.com/gomarkdown/markdown - https://github.com/gomarkdown/markdown/blob/master/LICENSE.txt (BSD)
|
||||
|
@ -119,12 +119,6 @@
|
||||
- Do something similar to `builtin.go` in gojq to speedup a bit
|
||||
- remove `scopedump`?
|
||||
|
||||
#### Readline
|
||||
|
||||
- Use something else than `github.com/chzyer/readline`?
|
||||
- Fixes for readline
|
||||
- Undo (ctrl+-) normal readline bahave differently for backspace (history for each character)
|
||||
|
||||
#### Big things
|
||||
|
||||
- fq play website?
|
||||
|
@ -341,7 +341,6 @@ docker --context 2016-box run --rm -ti -v "C:${PWD//\//\\}:C:${PWD//\//\\}" -w "
|
||||
## Implementation details
|
||||
|
||||
- fq uses a gojq fork that can be found at https://github.com/wader/gojq/tree/fq (the "fq" branch)
|
||||
- fq uses a readline fork that can be found at https://github.com/wader/readline/tree/fq (the "fq" branch)
|
||||
- cli readline uses raw mode to blocks ctrl-c to become a SIGINT
|
||||
|
||||
## Dependencies and source origins
|
||||
@ -363,7 +362,6 @@ Issues and PR:s related to fq:<br>
|
||||
[#125](https://github.com/itchyny/gojq/pull/125) improve performance of join by make it internal<br>
|
||||
[#141](https://github.com/itchyny/gojq/issues/141) Empty array flatten regression since "improve flatten performance by reducing copy"
|
||||
|
||||
- [readline](https://github.com/chzyer/readline) fork that can be found at https://github.com/wader/readline/tree/fq
|
||||
- [gopacket](https://github.com/gopacket/gopacket) for TCP and IPv4 reassembly
|
||||
- [mapstructure](https://github.com/mitchellh/mapstructure) for convenient JSON/map conversion
|
||||
- [go-difflib](https://github.com/pmezard/go-difflib) for diff tests
|
||||
|
16
go.mod
16
go.mod
@ -2,12 +2,8 @@ module github.com/wader/fq
|
||||
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
// fork of github.com/itchyny/gojq, see github.com/wader/gojq fq branch
|
||||
github.com/wader/gojq v0.12.1-0.20231105164134-2b6d9e2f4985
|
||||
// fork of github.com/chzyer/readline, see github.com/wader/readline fq branch
|
||||
github.com/wader/readline v0.0.0-20230307172220-bcb7158e7448
|
||||
)
|
||||
// fork of github.com/itchyny/gojq, see github.com/wader/gojq fq branch
|
||||
require github.com/wader/gojq v0.12.1-0.20231105164134-2b6d9e2f4985
|
||||
|
||||
require (
|
||||
// bump: gomod-BurntSushi/toml /github\.com\/BurntSushi\/toml v(.*)/ https://github.com/BurntSushi/toml.git|^1
|
||||
@ -20,6 +16,9 @@ require (
|
||||
// bump: gomod-creasty-defaults link "Source diff $CURRENT..$LATEST" https://github.com/creasty/defaults/compare/v$CURRENT..v$LATEST
|
||||
github.com/creasty/defaults v1.7.0
|
||||
|
||||
// go get -d github.com/ergochat/readline@master && go mod tidy
|
||||
github.com/ergochat/readline v0.0.7-0.20231224190314-495868e9b5e6
|
||||
|
||||
// bump: gomod-golang-snappy /github\.com\/golang\/snappy v(.*)/ https://github.com/golang/snappy.git|^0
|
||||
// bump: gomod-golang-snappy command go get -d github.com/golang/snappy@v$LATEST && go mod tidy
|
||||
// bump: gomod-golang-snappy link "Source diff $CURRENT..$LATEST" https://github.com/golang/snappy/compare/v$CURRENT..v$LATEST
|
||||
@ -63,6 +62,11 @@ require (
|
||||
// bump: gomod-golang-x-net link "Tags" https://github.com/golang/net/tags
|
||||
golang.org/x/net v0.19.0
|
||||
|
||||
// bump: gomod-golang-x-term /golang\.org\/x\/term v(.*)/ https://github.com/golang/term.git|^0
|
||||
// bump: gomod-golang-x-term command go get -d golang.org/x/term@v$LATEST && go mod tidy
|
||||
// bump: gomod-golang-x-term link "Tags" https://github.com/golang/term/tags
|
||||
golang.org/x/term v0.15.0
|
||||
|
||||
// bump: gomod-golang/text /golang\.org\/x\/text v(.*)/ https://github.com/golang/text.git|^0
|
||||
// bump: gomod-golang/text command go get -d golang.org/x/text@v$LATEST && go mod tidy
|
||||
// bump: gomod-golang/text link "Source diff $CURRENT..$LATEST" https://github.com/golang/text/compare/v$CURRENT..v$LATEST
|
||||
|
9
go.sum
9
go.sum
@ -2,6 +2,8 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8
|
||||
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/creasty/defaults v1.7.0 h1:eNdqZvc5B509z18lD8yc212CAqJNvfT1Jq6L8WowdBA=
|
||||
github.com/creasty/defaults v1.7.0/go.mod h1:iGzKe6pbEHnpMPtfDXZEr0NVxWnPTjb1bbDy08fPzYM=
|
||||
github.com/ergochat/readline v0.0.7-0.20231224190314-495868e9b5e6 h1:uCzaIvpSl/5f6U/vBdAy72gQVqTxtwpFsWsKM6ehjyE=
|
||||
github.com/ergochat/readline v0.0.7-0.20231224190314-495868e9b5e6/go.mod h1:8RNv74chpO0eTm6rdD1H6WZGihL5rJ+RfSlhv4fIfjg=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/gomarkdown/markdown v0.0.0-20231115200524-a660076da3fd h1:PppHBegd3uPZ3Y/Iax/2mlCFJm1w4Qf/zP1MdW4ju2o=
|
||||
@ -25,21 +27,18 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/wader/gojq v0.12.1-0.20231105164134-2b6d9e2f4985 h1:Zot2YzBLbILdZN2priMf/GS+Hwtyc2HBGRv85Zc3HlA=
|
||||
github.com/wader/gojq v0.12.1-0.20231105164134-2b6d9e2f4985/go.mod h1:cenZ41I34RfINFzOtmUa1MIFu0k+n6bLkaQcsZY/nnw=
|
||||
github.com/wader/readline v0.0.0-20230307172220-bcb7158e7448 h1:AzpBtmgdXa3uznrb3esNeEoaLqtNEwckRmaUH0qWD6w=
|
||||
github.com/wader/readline v0.0.0-20230307172220-bcb7158e7448/go.mod h1:Zgz8IJWvJoe7NK23CCPpC109XMCqJCpUhpHcnnA4XaM=
|
||||
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
|
||||
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
|
||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ=
|
||||
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE=
|
||||
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
|
||||
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
|
||||
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
|
||||
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4=
|
||||
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -13,9 +13,11 @@ import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/wader/fq/internal/mathex"
|
||||
"github.com/wader/fq/pkg/interp"
|
||||
"golang.org/x/term"
|
||||
|
||||
"github.com/wader/readline"
|
||||
"github.com/ergochat/readline"
|
||||
)
|
||||
|
||||
func maybeLogFile() {
|
||||
@ -88,11 +90,13 @@ func (stdOS) Platform() interp.Platform {
|
||||
type fdTerminal uintptr
|
||||
|
||||
func (fd fdTerminal) Size() (int, int) {
|
||||
w, h, _ := readline.GetSize(int(fd))
|
||||
w, h, _ := term.GetSize(int(fd))
|
||||
// TODO: old version return 0 on no terminal
|
||||
w, h = mathex.Max(0, w), mathex.Max(0, h)
|
||||
return w, h
|
||||
}
|
||||
func (fd fdTerminal) IsTerminal() bool {
|
||||
return readline.IsTerminal(int(fd))
|
||||
return term.IsTerminal(int(fd))
|
||||
}
|
||||
|
||||
type stdinInput struct {
|
||||
@ -175,6 +179,7 @@ func (o *stdOS) Readline(opts interp.ReadlineOpts) (string, error) {
|
||||
cfg := &readline.Config{
|
||||
HistoryFile: historyFile,
|
||||
HistorySearchFold: true,
|
||||
Undo: true,
|
||||
}
|
||||
cfg.AutoComplete = autoCompleterFn(func(line []rune, pos int) (newLine [][]rune, length int) {
|
||||
if o.completerFn == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user