Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
keyboard
✓ github.com/eiannone/keyboard
Reads a single key press from the terminal.
package main
import (
"fmt"
"github.com/eiannone/keyboard"
)
func main() {
if err := keyboard.Open(); err != nil {
panic(err)
}
defer keyboard.Close()
char, key, err := keyboard.GetSingleKey()
if err != nil {
panic(err)
}
fmt.Printf("You pressed: %c (key code: %d)\n", char, key)
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
0.0.0-20220611211555-0d226195f203latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.