2021-06-04
3317
#node
Shahed Nasser
48375
Jun 4, 2021 â‹… 11 min read

Creating a CLI tool with Node.js

Shahed Nasser I am a fullstack developer passionate about learning something new every day, then sharing my knowledge with the community.

Recent posts:

Building a Full-Featured Laravel Admin Dashboard with Filament

Building a full-featured Laravel admin dashboard with Filament

Build scalable admin dashboards with Filament and Laravel using Form Builder, Notifications, and Actions for clean, interactive panels.

Kayode Adeniyi
Dec 20, 2024 â‹… 5 min read
Working With URLs In JavaScript

Working with URLs in JavaScript

Break down the parts of a URL and explore APIs for working with them in JavaScript, parsing them, building query strings, checking their validity, etc.

Joe Attardi
Dec 19, 2024 â‹… 6 min read
Lazy Loading Vs. Eager Loading

Lazy loading vs. Eager loading

In this guide, explore lazy loading and error loading as two techniques for fetching data in React apps.

Njong Emy
Dec 18, 2024 â‹… 5 min read
Deno logo over an orange background

How to migrate your Node.js app to Deno 2.0

Deno is a popular JavaScript runtime, and it recently launched version 2.0 with several new features, bug fixes, and improvements […]

Yashodhan Joshi
Dec 17, 2024 â‹… 7 min read
View all posts

5 Replies to "Creating a CLI tool with Node.js"

  1. I am trying to add a command ‘remove’ which will remove a specific task
    `todos remove -r 0 1` something like this..

    my remove function looks like this..

    “`
    function remove({ tasks }) {
    let todoList = conf.get(‘todo-list’)

    if(todoList){
    if(tasks){
    todoList = todoList.filter((task, index) => {
    return !tasks.includes(index.toString());
    })
    }
    conf.set(‘todo-list’, todoList);
    }
    }
    “`

    But its not removed like this.. can you please help me here ?

  2. The command takes much more time than expected.. How to fast run those commands .. is there any way to do that ?

  3. Just a typo
    “bin”: {
    “todos”: “./index.js”
    },
    instead of
    “bin”: {
    “todos”: “index.js”
    },

  4. Is there a way to biding the paths used for static files, said `fs.readFile(“./folder/file.txt”, “utf-8”)` to be used as cli program ?

Leave a Reply