Create an interactive terminal cli with node

Let’s create a tool that will track our some text entries.

Step 1: Create a new npm project and install the necessary libraries

$ mkdir my_cli && cd my_cli && npm init -y && npm i --save inquirer chalk

chalk – helps color the terminal prompts

inquirer – makes creating interactive prompts a breeze

Step 2: create interactive terminal prompts

[gist https://gist.github.com/e6a61559934fbcfa32cfc6e22b03a2d6 /]

Step 3: save or append to a file (did.txt)

[gist https://gist.github.com/ada41090cb7761f13f30342c7d0117ba /]

Full code here

Leave a Reply

Your email address will not be published. Required fields are marked *