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:

Rust logo over black marble background.

Handling memory leaks in Rust

Learn how to manage memory leaks in Rust, avoid unsafe behavior, and use tools like weak references to ensure efficient programs.

Ukeje Goodness
Nov 20, 2024 â‹… 4 min read
Robot pretending to be a person.

Using curl-impersonate in Node.js to avoid blocks

Bypass anti-bot measures in Node.js with curl-impersonate. Learn how it mimics browsers to overcome bot detection for web scraping.

Antonello Zanini
Nov 20, 2024 â‹… 13 min read
Solving Eventual Consistency In Frontend

Solving eventual consistency in frontend

Handle frontend data discrepancies with eventual consistency using WebSockets, Docker Compose, and practical code examples.

Kayode Adeniyi
Nov 19, 2024 â‹… 6 min read
How To Use Lazy Initialization Pattern With Rust 1.80

How to use the lazy initialization pattern with Rust 1.80

Efficient initializing is crucial to smooth-running websites. One way to optimize that process is through lazy initialization in Rust 1.80.

Yashodhan Joshi
Nov 18, 2024 â‹… 5 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