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:

Comparing Mutative Vs Immer Vs Reducers For Data Handling In React

Comparing React state tools: Mutative vs. Immer vs. reducers

Mutative processes data with better performance than both Immer and native reducers. Let’s compare these data handling options in React.

Rashedul Alam
Apr 26, 2024 â‹… 7 min read
Radix Ui Adoption Guide Overview Examples And Alternatives

Radix UI adoption guide: Overview, examples, and alternatives

Radix UI is quickly rising in popularity and has become an excellent go-to solution for building modern design systems and websites.

Nefe Emadamerho-Atori
Apr 25, 2024 â‹… 11 min read
Understanding The Css Revert Layer Keyword, Part Of Css Cascade Layers

Understanding the CSS revert-layer keyword

In this article, we’ll explore CSS cascade layers — and, specifically, the revert-layer keyword — to help you refine your styling strategy.

Chimezie Innocent
Apr 24, 2024 â‹… 6 min read
Exploring Nushell, A Rust Powered, Cross Platform Shell

Exploring Nushell, a Rust-powered, cross-platform shell

Nushell is a modern, performant, extensible shell built with Rust. Explore its pros, cons, and how to install and get started with it.

Oduah Chigozie
Apr 23, 2024 â‹… 6 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