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:

How To Audit And Validate AI-Generated Code Output

How to audit and validate AI-generated code output

Validating and auditing AI-generated code reduces code errors and ensures that code is compliant.

Boemo Mmopelwa
Dec 2, 2024 â‹… 5 min read
Building A Background Remover With Vue And Transformers.js

Building a background remover with Vue and Transformers.js

Build a real-time image background remover in Vue using Transformers.js and WebGPU for client-side processing with privacy and efficiency.

Emmanuel John
Nov 29, 2024 â‹… 9 min read
Managing Search Parameters In Next.js With Nuqs

Managing search parameters in Next.js with nuqs

Optimize search parameter handling in React and Next.js with nuqs for SEO-friendly, shareable URLs and a better user experience.

Jude Miracle
Nov 27, 2024 â‹… 10 min read
React logo over a beige background

Data fetching with Remix’s loader function

Learn how Remix enhances SSR performance, simplifies data fetching, and improves SEO compared to client-heavy React apps.

Abhinav Anshul
Nov 26, 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