Low-level terminal primitives for MoonBit native targets, including tty state, platform stdio handles, VT command output, and host input decoding.
Dependencies
import {
"moonbit-community/tty"
"moonbit-community/tty/color" @tty/color
"moonbit-community/tty/input" @tty/input
}async fn main {
let tty = @tty.Tty::stdio()
tty.hide_cursor()
tty.set_cursor_position(1, 1)
tty.bold()
tty.set_foreground(Basic(Green))
tty.write("hello from tty\r\n")
tty.reset_style()
tty.show_cursor()
}async fn main {
let tty = @tty.Tty::stdio()
tty.with_raw_mode(() => {
tty.write("press q to quit\r\n")
while true {
match tty.read_event() {
Input(Key(key)) =>
match key.code {
Char('q') => break
_ => ()
}
Input(Paste(_)) => ()
Input(Mouse(_)) => ()
Input(FocusIn) => ()
Input(FocusOut) => ()
Input(Unknown(_)) => ()
Resize(_) => ()
}
}
})
}moon run examples/raw
moon run examples/input
moon run examples/color
moon run examples/cursor
moon run examples/pager -- README.md
moon run examples/agentmoon fmt
moon test .
moon test
moon check
moon infopub(open) trait Fd {
fn fd(Self) -> Int
}fn KeyboardEnhancementFlags::new(disambiguate_escape_codes? : Bool, report_event_types? : Bool, report_alternate_keys? : Bool, report_all_keys_as_escape_codes? : Bool, report_associated_text? : Bool) -> KeyboardEnhancementFlagsfn KeyboardEnhancementFlags::report_all_keys_as_escape_codes(self : KeyboardEnhancementFlags) -> Booltype Statetype Ttyasync fn[T] Tty::with_keyboard_enhancements(self : Tty, flags : KeyboardEnhancementFlags, f : async () -> T) -> TLow-level terminal primitives for MoonBit native targets, including tty state, platform stdio handles, VT command output, and host input decoding.
Dependencies