mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
30 lines
403 B
V
30 lines
403 B
V
|
module main
|
||
|
|
||
|
import readline
|
||
|
|
||
|
fn main() {
|
||
|
run() or { panic('${err}') }
|
||
|
}
|
||
|
|
||
|
fn run() ! {
|
||
|
$if windows {
|
||
|
eprintln('skipping test on windows for now')
|
||
|
return
|
||
|
} $else {
|
||
|
mut r := readline.Readline{}
|
||
|
r.enable_raw_mode_nosig()
|
||
|
defer {
|
||
|
r.disable_raw_mode()
|
||
|
}
|
||
|
|
||
|
for {
|
||
|
entered := r.read_char()!
|
||
|
if entered == `q` {
|
||
|
break
|
||
|
}
|
||
|
println('got ${entered}')
|
||
|
}
|
||
|
println('Goodbye.')
|
||
|
}
|
||
|
}
|