If you miss the first part here is the links
- How to create CLI scripts in Deno Part I - How to build a CLI command and install it locally in Deno in 5 minute
cliffy
This is a third party CLI framework for deno which will help you to build command line application using,
- options
- commands
- event handlers
- sub commands
For more info and example visit the official repository. To explore the frame work go through the example. The repo lack documentation, I know but the developer provide a good set of examples.

Greet CLI
Here is a quick example.
import { Command } from "https://deno.land/x/cliffy@v0.17.0/command/mod.ts"; new Command() .name('Greet') .version('0.0.1') .description('Greet') .example('Greeting people',"greet -g good-night") .option("-g --msg <msg:string>","Greeting with no space",{ default:'Good morning' , action:async({msg})=>{ console.log(msg); } }) .parse(Deno.args)
The above is simple greet program with Cliffy framework, which use option for -g for message, also have default value for the option
Run the script in deno
//run the script deno run app.ts -g good-evening //output good-evening //bring help deno run app.ts -h
Install the script locally
We can install our script locally using the deno install command so that can run without a deno command along shell.
deno install --unstable -f -n greet app.ts
Here -f is used to overwrite the existing file which is optional , -n is used to specify the name of the command which also optional (it will take the name of the .ts file instead, if no name is specified). The install command will place the file in your deno home directory.
Run the command
Running the command is as simple as running dir in shell.
greet -g Good-evening //try bring some help greet -h greet -anything
A complete CLI project for Deno users is hosted at GitHub, have a look.
You may love to read these Deno posts
- MariaDB connection using ORM in Deno - Deno example for using MySQL connector (denodb ORM) for MariaDB in a Deno app
- SQLite app using denodb in Deno - How to create SQLite deno app with Denodb ORM, an opensource module for deno
- MySQL connection using ORM in Deno - Example for MySQL connection using denodb ORM in Deno
- MySQL connection in Deno - Example for MySQL connections in Deno app using denodrivers.
- How to create CLI scripts in Deno Part II:cliffy - How to build a CLI command and install it locally in Deno in 5 minute
- How to create CLI scripts in Deno Part I - How to build a CLI command and install it locally in Deno in 5 minute
- Inbuilt watch mode for reloading server automatically in Deno - How to use watch mode in deno for reloading server automatically
- How to host deno modules in GitHub - How to host deno modules on GitHub
- Hot reloading in Deno - Hot reloading with denon in Deno
- Use dotenv in Deno - How to create basic app with deno