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:

Rxjs Adoption Guide: Overview, Examples, And Alternatives

RxJS adoption guide: Overview, examples, and alternatives

Get to know RxJS features, benefits, and more to help you understand what it is, how it works, and why you should use it.

Emmanuel Odioko
Jul 26, 2024 â‹… 13 min read
Decoupling Monoliths Into Microservices With Feature Flags

Decoupling monoliths into microservices with feature flags

Explore how to effectively break down a monolithic application into microservices using feature flags and Flagsmith.

Kayode Adeniyi
Jul 25, 2024 â‹… 10 min read
Lots of multi-colored blue and purplish rectangles.

Animating dialog and popover elements with CSS @starting-style

Native dialog and popover elements have their own well-defined roles in modern-day frontend web development. Dialog elements are known to […]

Rahul Chhodde
Jul 24, 2024 â‹… 10 min read
Using Llama Index To Add Personal Data To Large Language Models

Using LlamaIndex to add personal data to LLMs

LlamaIndex provides tools for ingesting, processing, and implementing complex query workflows that combine data access with LLM prompting.

Ukeje Goodness
Jul 23, 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