Merge branch 'main' of github.com:johnkerl/miller

This commit is contained in:
John Kerl 2022-07-07 13:16:33 -04:00
commit b5da018538
5 changed files with 31 additions and 0 deletions

1
go.mod
View file

@ -22,6 +22,7 @@ require (
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/lestrrat-go/strftime v1.0.6
github.com/mattn/go-isatty v0.0.14
github.com/nine-lives-later/go-windows-terminal-sequences v1.0.4 // indirect
github.com/pkg/profile v1.6.0
github.com/stretchr/testify v1.8.0
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654

2
go.sum
View file

@ -13,6 +13,8 @@ github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205Ah
github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/nine-lives-later/go-windows-terminal-sequences v1.0.4 h1:NC4H8hewgaktBqMI5yzy6L/Vln5/H7BEziyxaE2fX3Y=
github.com/nine-lives-later/go-windows-terminal-sequences v1.0.4/go.mod h1:eUQxpEiJy001RoaLXrNa5+QQLYiEgmEafwWuA3ppJSo=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/profile v1.6.0 h1:hUDfIISABYI59DyeB3OTay/HxSRwTQ8rB/H83k6r5dM=

View file

@ -33,6 +33,10 @@ func Main() MainReturn {
// as-is.)
os.Args = platform.GetArgs()
// Enable ANSI escape sequence processing on the Windows pseudo terminal,
// otherwise, we only raw ANSI escape sequences like ←[0;30m 0←[0m ←[0;31m 1
platform.EnableAnsiEscapeSequences()
// Expand "-xyz" into "-x -y -z" while leaving "--xyz" intact. This is a
// keystroke-saver for the user.
//

View file

@ -0,0 +1,8 @@
//go:build !windows
// +build !windows
package platform
func EnableAnsiEscapeSequences() {
}

View file

@ -0,0 +1,16 @@
//go:build windows
// +build windows
package platform
import (
"syscall"
sequences "github.com/nine-lives-later/go-windows-terminal-sequences"
)
func EnableAnsiEscapeSequences() {
sequences.EnableVirtualTerminalProcessing(syscall.Stdout, true)
sequences.EnableVirtualTerminalProcessing(syscall.Stderr, true)
}