Deno is a JavaScript/TypeScript runtime with secure defaults and great developer experience. It’s built on V8, Rust, and Tokio. I suggest you watch these talks by Ryan: He talks about his mistakes with Nodejs here and a more in-depth look into deno here
In this article, we’re going to build a simple cli tool to demonstrate some of the features of deno. Our cli will be interacting with a COVID API to fetch live data.
Requirement: make sure you have deno installed. If you don’t, refer to this link. It’s pretty straightforward.
Deno has the entry file mod.ts
so we will follow the same in this article if you are following this article along with the coding you can create a folder named covid-cli
, inside that folder you can create a file called mod.ts
and copy the below code there.
const { args } = Deno;
import { parse } from "https://deno.land/std/flags/mod.ts";
console.dir(parse(args));
Here the parse(args, options = {});
contains two parameters where args is an Array
and options
is an object, let try to run the above code using this cmd.
deno run mod.ts arg1 -f hello --flag World --booleanFlag
#deno #cli tool #tool