Enable terminal colors on Windows 10
This commit is contained in:
parent
91478dd20e
commit
9988800431
@ -6,14 +6,23 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
"git.kill0.net/chill9/lume"
|
lifx "git.kill0.net/chill9/lume"
|
||||||
lumecmd "git.kill0.net/chill9/lume/cmd"
|
lumecmd "git.kill0.net/chill9/lume/cmd"
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
|
|
||||||
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
const lumercFile = ".lumerc"
|
const lumercFile = ".lumerc"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
var originalMode uint32
|
||||||
|
stdout := windows.Handle(os.Stdout.Fd())
|
||||||
|
|
||||||
|
windows.GetConsoleMode(stdout, &originalMode)
|
||||||
|
windows.SetConsoleMode(stdout, originalMode|windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING)
|
||||||
|
defer windows.SetConsoleMode(stdout, originalMode)
|
||||||
|
|
||||||
var config lumecmd.Config
|
var config lumecmd.Config
|
||||||
homeDir, err := os.UserHomeDir()
|
homeDir, err := os.UserHomeDir()
|
||||||
_, err = toml.DecodeFile(path.Join(homeDir, lumercFile), &config)
|
_, err = toml.DecodeFile(path.Join(homeDir, lumercFile), &config)
|
||||||
|
5
go.mod
5
go.mod
@ -2,4 +2,7 @@ module git.kill0.net/chill9/lume
|
|||||||
|
|
||||||
go 1.15
|
go 1.15
|
||||||
|
|
||||||
require github.com/BurntSushi/toml v0.3.1
|
require (
|
||||||
|
github.com/BurntSushi/toml v0.3.1
|
||||||
|
golang.org/x/sys v0.0.0-20210110051926-789bb1bd4061
|
||||||
|
)
|
||||||
|
2
go.sum
2
go.sum
@ -1,2 +1,4 @@
|
|||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
|
golang.org/x/sys v0.0.0-20210110051926-789bb1bd4061 h1:DQmQoKxQWtyybCtX/3dIuDBcAhFszqq8YiNeS6sNu1c=
|
||||||
|
golang.org/x/sys v0.0.0-20210110051926-789bb1bd4061/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
Loading…
Reference in New Issue
Block a user