Skip to content

Expose more convenient API for common keys #3

@galaktor

Description

@galaktor

For ASCII alpha-numeric characters and very common keys such as Enter, shift, ctrl, arrows... create an abstraction on the keyboard the exposes those with utmost simplicity, i.e.

type LazyKey interface {
Press() error
Release() error
Punch() error
}

type LazyKeyboard interface {
A() LazyKey
B() LazyKey
// ... etc
Enter() LazyKey
}

// usage
func main() {
// wrap keyboard in lazy wrapper
kb := gostwriter.LazyKeyboard(gostwriter.New("foo"))

// be a good girl and handle errors
err := kb.A().Press()
// handle the error somehow

// or ignore errors, whatever
kb.A().Punch()

}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions