nodecli

website·Indexed 33 days ago

https://create.nodecli.com/

A tool to create a Node.js CLI quickly, featuring automatic setup and installation via npx.

Tokens
542
Snippets
7
Records
8
Agent score
0%

What's inside nodecli

  1. Overview of NodeCLI features

    NodeCLI is a tool designed to create Node.js command-line interfaces (CLIs) quickly. Key features include:

    • Rapid CLI creation (under a minute).
    • Automatic generation of argument parsing, help text, and welcome messages.
    • Built-in history management to persist user input data such as author name, email, and URL.
  2. Use create-node-cli basic command syntax

    The create-node-cli tool follows a standard command-line interface syntax where a command is required, followed by optional flags.
    create-node-cli <command> [option]
  3. Understand the default NodeCLI project structure

    After creating a new CLI project with NodeCLI, the directory structure is organized to separate the main entry point from utility logic. The index.js file serves as the primary entry point, while the utils/ directory contains helper modules for CLI orchestration (cli.js), initialization logic (init.js), and logging functionality (log.js).
    my-cli/
      index.js
      node_modules/
      package.json
      package-lock.json
      utils/
        cli.js
        init.js
        log.js
  4. Install create-node-cli globally via npm

    If you prefer not to use npx, you can install the create-node-cli package globally on your system.
    npm install -g create-node-cli
  5. Install and run create-node-cli using npx

    The recommended way to start generating a Node.js CLI is by using npx. This requires npm version 5.2 or higher.
    npx create-node-cli
  6. Configure create-node-cli global options

    The following options can be used with create-node-cli to modify its behavior:

    • -c, --clear: Clears the console before execution. (Default: true)
    • -d, --debug: Enables printing of debug information. (Default: false)
    • -v, --version: Prints the current CLI version. (Default: false)
    # Example: Run with debug info enabled
    create-node-cli <command> --debug
    
    # Example: Check version
    create-node-cli <command> -v
  7. Run the create-node-cli tool

    Depending on your installation method, use one of the following commands to launch the CLI generator. After launching, follow the interactive prompts to generate your Node.js CLI. To view available commands and options, use the help command.
    # Using npx
    npx create-node-cli
    
    # Using global installation
    create-node-cli
    
    # Using the global alias
    ncli