Cross-platform console I/O library
Dependencies
@console.write_line("hello")
let line = @console.read_line()
@console.write_line("you typed: \{line}")///|
let id = @console.add_cancel_key_press_handler(fn(key) {
match key {
ControlC => @console.write_line("ctrl-c")
ControlBreak => @console.write_line("ctrl-break")
}
true // true => handled, false => default terminate behavior
})@console.start_async_cancel_dispatcher()moon testpython3 integration/run_linux_integration.pypython integration/run_windows_integration.pypub(all) enum ConsoleKey {
Backspace
Tab
Enter
Escape
Space
PageUp
PageDown
End
Home
LeftArrow
UpArrow
RightArrow
DownArrow
Insert
Delete
D0
D1
D2
D3
D4
D5
D6
D7
D8
D9
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
LeftWindows
RightWindows
Apps
Sleep
NumPad0
NumPad1
NumPad2
NumPad3
NumPad4
NumPad5
NumPad6
NumPad7
NumPad8
NumPad9
Multiply
Add
Separator
Subtract
Decimal
Divide
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
} derive(Eq, Debug)pub struct ConsoleKeyInfo {
key_char : Char
key : ConsoleKey
shift : Bool
alt : Bool
control : Bool
}fn ConsoleKeyInfo::new(key_char : Char, key : ConsoleKey, shift : Bool, alt : Bool, control : Bool) -> ConsoleKeyInfopub(all) enum ConsoleSpecialKey {
ControlC
ControlBreak
}pub(all) enum StandardHandle {
StandardInput
StandardOutput
StandardError
}