{"componentChunkName":"component---src-pages-markdown-remark-fields-slug-js","path":"/engineering/build-a-cli-tool-using-deno/","result":{"data":{"markdownRemark":{"id":"8ea36e93-04d5-54e6-a5d7-7fe5d7dd8707","excerpt":"What is Deno? Deno is a JavaScript/TypeScript runtime with secure defaults and great developer experience. It's built on V8, Rust, and Tokio.\nI suggest you…","html":"<h3 id=\"what-is-deno\" style=\"position:relative;\"><a href=\"#what-is-deno\" aria-label=\"what is deno permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>What is Deno?</h3>\n<p>Deno is a JavaScript/TypeScript runtime with secure defaults and great developer experience. It's built on V8, Rust, and Tokio.\nI suggest you watch these talks by Ryan: He talks about his mistakes with Nodejs <a href=\"https://www.youtube.com/watch?v=M3BM9TB-8yA&#x26;vl=en\">here</a> and a more in-depth look into deno <a href=\"https://www.youtube.com/watch?v=z6JRlx5NC9E\">here</a></p>\n<h5 id=\"features\" style=\"position:relative;\"><a href=\"#features\" aria-label=\"features permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Features</h5>\n<ul>\n<li>Secure by default. No file, network, or environment access (unless explicitly enabled).</li>\n<li>Supports TypeScript out of the box.</li>\n<li>Ships a single executable (deno).</li>\n<li>Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).</li>\n<li>Has a set of reviewed (audited) standard modules that are guaranteed to work with Deno.\nScripts can be bundled into a single JavaScript file.</li>\n</ul>\n<h3 id=\"lets-build-something\" style=\"position:relative;\"><a href=\"#lets-build-something\" aria-label=\"lets build something permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Let's Build Something!!!</h3>\n<p>In this article, we're going to build a simple cli tool to demonstrate some of the features of <a href=\"https://deno.land/\">deno</a>. Our cli will be interacting with a <strong>COVID</strong> API to fetch live data.</p>\n<blockquote>\n<p>Requirement: make sure you have deno installed. If you don't, refer to this <a href=\"/hello-world-deno/\">link</a>. It's pretty straightforward.</p>\n</blockquote>\n<p>Deno has the entry file <code>mod.ts</code> 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 <code>covid-cli</code>, inside that folder you can create a file called <code>mod.ts</code> and copy the below code there.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">args</span><span class=\"mtk1\"> } = </span><span class=\"mtk12\">Deno</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">parse</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;https://deno.land/std/flags/mod.ts&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">dir</span><span class=\"mtk1\">(</span><span class=\"mtk11\">parse</span><span class=\"mtk1\">(</span><span class=\"mtk12\">args</span><span class=\"mtk1\">));</span></span></code></pre>\n<p>Here the <code>parse(args, options = {});</code> contains two parameters where args is an <code>Array</code> and <code>options</code> is an object, let try to run the above code using this cmd.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">deno run mod.ts arg1 -f hello --flag World --booleanFlag</span></code></pre>\n<p>After running the above code you will see the <strong>output</strong> as</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">{ _: [ &quot;arg1&quot; ], f: &quot;hello&quot;, flag: &quot;World&quot;, booleanFlag: true }</span></code></pre>\n<blockquote>\n<p>The first property in the object is always an array containing all arguments that did not have an option associated with them(i.e it doesn't match -f or --flag). If you do not pass a corresponding value to a flag, it defaults to true.</p>\n</blockquote>\n<p>I will be using the <a href=\"https://documenter.getpostman.com/view/10808728/SzS8rjbc?version=latest\">this</a> postman doc for all the COVID related API and we will perform the below to action through our CLI.</p>\n<ol>\n<li>A summary of new and total cases globally updated daily.</li>\n<li>A summary of new and total cases per country updated daily.</li>\n</ol>\n<p>Let's write out the function for our first command, so our <code>mod.ts</code> file will look like this.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"ts\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">args</span><span class=\"mtk1\"> } = </span><span class=\"mtk12\">Deno</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> { </span><span class=\"mtk12\">parse</span><span class=\"mtk1\"> } </span><span class=\"mtk15\">from</span><span class=\"mtk1\"> </span><span class=\"mtk8\">&quot;https://deno.land/std/flags/mod.ts&quot;</span><span class=\"mtk1\">;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// flags:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// -h, --help: display help message</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// -g, --global: display global stats</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\">// -c, --country: get data of mentioned country</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">BASE_URL</span><span class=\"mtk1\">: </span><span class=\"mtk10\">string</span><span class=\"mtk1\"> = </span><span class=\"mtk8\">&quot;https://api.covid19api.com/&quot;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">parsedArgs</span><span class=\"mtk1\"> = </span><span class=\"mtk11\">parse</span><span class=\"mtk1\">(</span><span class=\"mtk12\">args</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk4\">async</span><span class=\"mtk1\"> </span><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">getGlobalStats</span><span class=\"mtk1\">() {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">res</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk11\">fetch</span><span class=\"mtk1\">(</span><span class=\"mtk8\">`</span><span class=\"mtk4\">${</span><span class=\"mtk12\">BASE_URL</span><span class=\"mtk4\">}</span><span class=\"mtk8\">summary`</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">data</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk12\">res</span><span class=\"mtk1\">.</span><span class=\"mtk11\">json</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">data</span><span class=\"mtk1\">[</span><span class=\"mtk8\">&quot;Global&quot;</span><span class=\"mtk1\">])</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>Here, we have an async function that returns the data from our API call. We're making a fetch request (yes, deno has browser functionality in-built) to the API endpoint to get the global stat of covid19.</p>\n<p>The function for the second command looks very similar, just we need to filter our data only for a particular country which is provided.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"javascript\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk4\">async</span><span class=\"mtk1\"> </span><span class=\"mtk4\">function</span><span class=\"mtk1\"> </span><span class=\"mtk11\">getCountryStats</span><span class=\"mtk1\">(</span><span class=\"mtk12\">country</span><span class=\"mtk1\">: </span><span class=\"mtk10\">string</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">country</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">res</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk11\">fetch</span><span class=\"mtk1\">(</span><span class=\"mtk8\">`</span><span class=\"mtk4\">${</span><span class=\"mtk12\">BASE_URL</span><span class=\"mtk4\">}</span><span class=\"mtk8\">summary`</span><span class=\"mtk1\">);</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">data</span><span class=\"mtk1\"> = </span><span class=\"mtk15\">await</span><span class=\"mtk1\"> </span><span class=\"mtk12\">res</span><span class=\"mtk1\">.</span><span class=\"mtk11\">json</span><span class=\"mtk1\">();</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk4\">const</span><span class=\"mtk1\"> </span><span class=\"mtk12\">index</span><span class=\"mtk1\"> = </span><span class=\"mtk12\">data</span><span class=\"mtk1\">[</span><span class=\"mtk8\">&quot;Countries&quot;</span><span class=\"mtk1\">].</span><span class=\"mtk11\">findIndex</span><span class=\"mtk1\">((</span><span class=\"mtk12\">c</span><span class=\"mtk1\">: </span><span class=\"mtk10\">any</span><span class=\"mtk1\">) </span><span class=\"mtk4\">=&gt;</span><span class=\"mtk1\"> </span><span class=\"mtk12\">c</span><span class=\"mtk1\">.</span><span class=\"mtk12\">Country</span><span class=\"mtk1\">.</span><span class=\"mtk11\">toLowerCase</span><span class=\"mtk1\">() === </span><span class=\"mtk12\">country</span><span class=\"mtk1\">.</span><span class=\"mtk11\">toLowerCase</span><span class=\"mtk1\">())</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk15\">if</span><span class=\"mtk1\"> (</span><span class=\"mtk12\">index</span><span class=\"mtk1\"> !== -</span><span class=\"mtk7\">1</span><span class=\"mtk1\">) {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk12\">data</span><span class=\"mtk1\">[</span><span class=\"mtk8\">&quot;Countries&quot;</span><span class=\"mtk1\">][</span><span class=\"mtk12\">index</span><span class=\"mtk1\">])</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    } </span><span class=\"mtk15\">else</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">        </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Country Not Found&quot;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  } </span><span class=\"mtk15\">else</span><span class=\"mtk1\"> {</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk10\">console</span><span class=\"mtk1\">.</span><span class=\"mtk11\">log</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;Country Name is needed&quot;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">  }</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">}</span></span></code></pre>\n<p>We will now write our <code>main()</code> function. We have a switch statement to check the first flag that was passed and calls the appropriate function. The default case simply displays a welcome message. Let add the below code in our <code>mod.ts</code> file</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">async function main() {</span>\n<span class=\"grvsc-line\">  switch (Object.keys(parsedArgs)[1]) {</span>\n<span class=\"grvsc-line\">    case &quot;help&quot;:</span>\n<span class=\"grvsc-line\">    case &quot;h&quot;:</span>\n<span class=\"grvsc-line\">      console.log(displayHelpMsg());</span>\n<span class=\"grvsc-line\">      break;</span>\n<span class=\"grvsc-line\">    case &quot;global&quot;:</span>\n<span class=\"grvsc-line\">    case &quot;g&quot;:</span>\n<span class=\"grvsc-line\">      await getGlobalStats();</span>\n<span class=\"grvsc-line\">      break;</span>\n<span class=\"grvsc-line\">    case &quot;country&quot;:</span>\n<span class=\"grvsc-line\">    case &quot;c&quot;:</span>\n<span class=\"grvsc-line\">       let country = parsedArgs.c || parsedArgs.country || &quot;&quot;</span>\n<span class=\"grvsc-line\">       await getCountryStats(country)</span>\n<span class=\"grvsc-line\">       break;</span>\n<span class=\"grvsc-line\">    default:</span>\n<span class=\"grvsc-line\">       console.log(displayHelpMsg());</span>\n<span class=\"grvsc-line\">  }</span>\n<span class=\"grvsc-line\">}</span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\">main()</span></code></pre>\n<p>And our <code>displayHelpMsg()</code> will look something like this</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\">function displayHelpMsg() {</span>\n<span class=\"grvsc-line\">  return &quot;flags:\\n-h, --help: display help message\\n-g, --global: display global stats\\n-c, --country: get data of mentioned country &quot;;</span>\n<span class=\"grvsc-line\">}</span></code></pre>\n<h3 id=\"testing-time\" style=\"position:relative;\"><a href=\"#testing-time\" aria-label=\"testing time permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Testing Time!!!</h3>\n<p>To test our program, we're going to run $ deno run <code>--allow-net mod.ts -g</code>. We should get the following result:</p>\n<ul>\n<li>For Global Records</li>\n</ul>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 529px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 30.434782608695656%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAwklEQVQY052Q20rDQBRFTy6VzGQqnWaoNFMwSUMvijc0sdj8/28tD/0AIT6shwObxd5HjLHEGAlV4H65ZLN50LslhJqmadntIlVVYY1BREjT9E/E+xVd11Fvt7RNp6LAfi8ceiHP5CaZhfeey+Wb15c3np9OfLw3NI939CqMdaahZK5wxfX6wziMnE9nbZkyfInOz2+BJJnZcL32TNOkkkEZOR56bZwwfGY494/JRp9dFAVl6bDWUFrHYpHjveDK+cJf0ASG38Zw4SUAAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"global-data\"\n        title=\"global-data\"\n        src=\"/static/f5e1dc8db77f90036f3afb3632db5c4a/67d6a/global-data.png\"\n        srcset=\"/static/f5e1dc8db77f90036f3afb3632db5c4a/67d6a/global-data.png 529w\"\n        sizes=\"(max-width: 529px) 100vw, 529px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<ul>\n<li>For Country Wise Record</li>\n</ul>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 540px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 43.333333333333336%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAJCAYAAAAywQxIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA9klEQVQoz6WR3U7CQBBGp102DaCttqVAqcUuS/hxKxA0iPj+r3VcondeUS/OzUxy5psZmc0qxuMxWZpRZBOa2jCva+p6jjGGNH1kNCqwdkkSxyil0Fr/IQxD8jxHrsKqrBjeD4gqYVCGiEgnYj9Q3EuLsXOatuLBRKipbwaqkzBJEuTrcsEuDPbopZuGZRPwVCmCoKPwcDiw3+1Z2TWvbuHvN6R5Fka56ib8PJ85n0441/pH9NluBBX+Y+WTl3143o7vuLXzKTW7VhHfBd2E69WGYpqRbQcULiaxEWUrTLaKqBTC/o1C3dM/hZ5H/3J9iBICfXvCb90VyQaeJu7lAAAAAElFTkSuQmCC'); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"country-data\"\n        title=\"country-data\"\n        src=\"/static/127ea015735159e5a971037b03086626/07484/country-data.png\"\n        srcset=\"/static/127ea015735159e5a971037b03086626/07484/country-data.png 540w\"\n        sizes=\"(max-width: 540px) 100vw, 540px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<ul>\n<li>For Help</li>\n</ul>\n<p><span\n      class=\"gatsby-resp-image-wrapper\"\n      style=\"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 539px; \"\n    >\n      <span\n    class=\"gatsby-resp-image-background-image\"\n    style=\"padding-bottom: 19.109461966604822%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAECAYAAACOXx+WAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAmElEQVQY04WQwQ6DIBBE6cWCAtooknLB4NGUiOj/f9p0MfVqDy+zmcPszrJlWTD0PbTWUErBWgs7jujJK3PxBOdgjBGPn97gvUfBDAbOOUx+gjE0vx35E+YQwPnzf9BFuSTnAzklhDBjzzvSuiKlDfETsZEfY0TXdeeiF+ltYFVVaBoJJSXquj4p9YUQJ6Xy9Y62baFJ7wK/88xcqip0NT8AAAAASUVORK5CYII='); background-size: cover; display: block;\"\n  ></span>\n  <img\n        class=\"gatsby-resp-image-image\"\n        alt=\"help\"\n        title=\"help\"\n        src=\"/static/e4adbfd05826f98cf308261ca2215093/10f9a/help.png\"\n        srcset=\"/static/e4adbfd05826f98cf308261ca2215093/10f9a/help.png 539w\"\n        sizes=\"(max-width: 539px) 100vw, 539px\"\n        style=\"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;\"\n        loading=\"lazy\"\n      />\n    </span></p>\n<p>That's all there is for our cli tool. If you'd like to see the full code, the repository is linked <a href=\"https://github.com/LoginRadius/engineering-blog-samples/tree/master/Deno/covid-cli\">here</a>. In conclusion, Deno is a very exciting project especially because you get all the benefits of typescript out of the box without the need to compile your files to js. </p>\n<p>You can build a lot with it, ranging from cli Programs to HTTP servers. Do have a look at one of my <a href=\"/a-webapp-in-deno/\">blog</a> where I have built a basic calculator app using the <a href=\"https://deno.land/x/abc@v1.3.3\">abc</a> module.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk10 { color: #4EC9B0; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n</style>","headings":[{"value":"What is Deno?","depth":3},{"value":"Features","depth":5},{"value":"Let's Build Something!!!","depth":3},{"value":"Testing Time!!!","depth":3}],"fields":{"slug":"/engineering/build-a-cli-tool-using-deno/"},"frontmatter":{"metatitle":null,"metadescription":null,"description":null,"title":"Build A Simple CLI Tool using Deno","canonical":null,"date":"June 08, 2020","updated_date":null,"tags":["Deno","CLI","Programming"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.7857142857142858,"src":"/static/313a3b2de31b5d15db618e72b377a867/03979/cli-tool.png","srcSet":"/static/313a3b2de31b5d15db618e72b377a867/f5f11/cli-tool.png 200w,\n/static/313a3b2de31b5d15db618e72b377a867/6d133/cli-tool.png 400w,\n/static/313a3b2de31b5d15db618e72b377a867/03979/cli-tool.png 800w,\n/static/313a3b2de31b5d15db618e72b377a867/47c9a/cli-tool.png 860w","sizes":"(max-width: 800px) 100vw, 800px"}}},"author":{"id":"Mohammed Modi","github":"mohammed786","bio":"Mohammed Modi is a software developer at LoginRadius and have an experience in working in most of the javascript framework including React, NodeJS, Angular etc.","avatar":null}}}},"pageContext":{"id":"8ea36e93-04d5-54e6-a5d7-7fe5d7dd8707","fields__slug":"/engineering/build-a-cli-tool-using-deno/","__params":{"fields__slug":"engineering"}}},"staticQueryHashes":["1171199041","1384082988","1711371485","1753898100","2100481360","229320306","23180105","528864852"]}