diff options
author | Anthony Wang | 2022-03-27 17:58:47 -0500 |
---|---|---|
committer | Anthony Wang | 2022-03-27 17:58:47 -0500 |
commit | a5977b9500bbd5486e9fae080ac49d9325b0d1ae (patch) | |
tree | e6bca0c76466ad5e9a0c93e54e4d919257ea7c3a | |
parent | f038ce57449fcbcba31b229ed0f0090c07eff34f (diff) |
Add golang.org/x/term module for raw input
-rw-r--r-- | go.mod | 5 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | sd.go | 15 |
3 files changed, 22 insertions, 2 deletions
@@ -1,3 +1,8 @@ module sd go 1.18 + +require ( + golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect +) @@ -0,0 +1,4 @@ +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1,9 +1,20 @@ package main import ( - "fmt" + "flag" + "os" + + "golang.org/x/term" ) +var file = flag.String("f", "cards", "cards file") + func main() { - fmt.Println("hello world") + flag.Parse() + + oldState, err := term.MakeRaw(int(os.Stdin.Fd())) + if err != nil { + panic(err) + } + defer term.Restore(int(os.Stdin.Fd()), oldState) } |