mirror of https://github.com/mum4k/termdash.git
Created Keyboard API (markdown)
parent
92e1d764f9
commit
538a383642
|
@ -0,0 +1,25 @@
|
||||||
|
# Keyboard API
|
||||||
|
|
||||||
|
[![Doc Status](https://godoc.org/github.com/mum4k/termdash/keyboard?status.png)](https://godoc.org/github.com/mum4k/termdash/keyboard)
|
||||||
|
|
||||||
|
The [keyboard](https://github.com/mum4k/termdash/tree/master/keyboard) package exposes types that represent keys on the keyboard.
|
||||||
|
|
||||||
|
This is a data-only package which provides types that are accepted by the infrastructure and widgets in multiple locations.
|
||||||
|
|
||||||
|
The public API surface of this package consists of the following:
|
||||||
|
|
||||||
|
## [keyboard.Key](https://github.com/mum4k/termdash/blob/b8591308b93dbd58d97e3a83998e180ecc17cf11/keyboard/keyboard.go#L18-L22)
|
||||||
|
|
||||||
|
The **keyboard.Key** type represents keys on the keyboard. The package provides predefined values for some of the keys which can be used directly, e.g:
|
||||||
|
|
||||||
|
```go
|
||||||
|
var key Keyboard
|
||||||
|
key = keyboard.KeyEnter
|
||||||
|
```
|
||||||
|
|
||||||
|
For all other keys like regular letters, the character that represents the letter can be directly assigned to the Key type.
|
||||||
|
|
||||||
|
```go
|
||||||
|
var key Keyboard
|
||||||
|
key = 'a'
|
||||||
|
```
|
Loading…
Reference in New Issue