Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

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.

Tags:

Deno

Related

Efficient algorithm for getting number of partitions of integer with distinct parts (Partition function Q) GraphQL server with Deno C++ pow() function changes behaviour when put inside a function Qt VS Tools: error reading VS project settings Align selected item in scrolling html dropdown how to remove negetive value in nested list SwiftUI Navigation link doesn't work when filtering ForEach How to make create-react-app use npm instead of yarn? Seq is already in use/consumed (nested gather / take ) Error : "Could not connect to any servers in your MongoDB Atlas cluster" how to change string matrix to a integer matrix Netsuite: How to link Purchase Order to Sales Order

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy