CLI REPL with Deno
You can use std/io
to build a REPL.
import { readLines } from "https://deno.land/[email protected]/io/bufio.ts";
async function read() {
// Listen to stdin input, once a new line is entered return
for await(const line of readLines(Deno.stdin)) {
console.log('Received', line)
return line;
}
}
console.log('Start typing');
while(true) {
await read()
}
You can build from here, process each line, add commands and so on.