From 5f143cc5f0da49be5c23d3fe4445d1b195d12121 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 18 Mar 2021 16:30:04 -0400 Subject: [PATCH] First commit --- gilo.go | 19 +++++++++++++++++++ go.mod | 5 +++++ go.sum | 4 ++++ 3 files changed, 28 insertions(+) create mode 100644 gilo.go create mode 100644 go.mod create mode 100644 go.sum diff --git a/gilo.go b/gilo.go new file mode 100644 index 0000000..94e69cb --- /dev/null +++ b/gilo.go @@ -0,0 +1,19 @@ +package main + +import ( + "golang.org/x/term" + "os" +) + +func goRaw() (*term.State, error) { + return term.MakeRaw(int(os.Stdin.Fd())) +} + +func main() { + oldState, err := goRaw() + if err != nil { + panic(err) + } + + defer term.Restore(int(os.Stdin.Fd()), oldState) +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..a4cc51c --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module timshomepage.net/gilo + +go 1.16 + +require golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..02a0d0b --- /dev/null +++ b/go.sum @@ -0,0 +1,4 @@ +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20210317153231-de623e64d2a6 h1:EC6+IGYTjPpRfv9a2b/6Puw0W+hLtAhkV1tPsXhutqs= +golang.org/x/term v0.0.0-20210317153231-de623e64d2a6/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=