1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
//! Crokey helps incorporate configurable keybindings in [crossterm](https://github.com/crossterm-rs/crossterm)
//! based terminal applications by providing functions
//! - parsing key combinations from strings
//! - describing key combinations in strings
mod consts;
mod format;
mod parse;
pub use {
consts::*,
format::*,
parse::*,
};
use {
crossterm::event::{
KeyCode,
KeyEvent,
KeyModifiers,
},
};
/// return the raw char if the event is a letter event
pub const fn as_letter(key: KeyEvent) -> Option<char> {
match key {
KeyEvent { code: KeyCode::Char(l), modifiers: KeyModifiers::NONE } => Some(l),
_ => None,
}
}