Documentation ¶
Overview ¶
Package hotkey provides support functions for managing hotkeys in terminal/console application.
Function Add is the most common requirement:
h := hotkey.New() h.Add("H", func() { fmt.Println("This is Help") })
Note that on non-Unix systems os.Stdin.Fd() may not be 0 and Getch() may run incorrectly
Index ¶
- type Hotkey
- func (h *Hotkey) Add(keys interface{}, description string, action func(h *Hotkey)) *Hotkey
- func (h *Hotkey) AddUnknown(action func(h *Hotkey, ch []byte)) *Hotkey
- func (h *Hotkey) NextKeyAction(f func(ch []byte))
- func (h *Hotkey) Run() *Hotkey
- func (h *Hotkey) SetState(state interface{}) *Hotkey
- func (h *Hotkey) SetStopAction(f func())
- func (h *Hotkey) State() interface{}
- func (h *Hotkey) Stop()
- func (h *Hotkey) String() (str string)
- type KeyCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hotkey ¶
type Hotkey struct {
// contains filtered or unexported fields
}
func (*Hotkey) AddUnknown ¶
AddUnknown add action function which executes when unknown key pressed
func (*Hotkey) NextKeyAction ¶
NextKeyAction set action which execute when key pressed nex time
func (*Hotkey) SetState ¶
SetState set users menu state. State is some interface which user can use in its hotkey menu. State is place where user can save its own menu parameters
func (*Hotkey) SetStopAction ¶
func (h *Hotkey) SetStopAction(f func())
SetStopAction set callback function which will run when hotkey menu Stop
Click to show internal directories.
Click to hide internal directories.