1.1.1 • Published 4 months ago

ezi-cli v1.1.1

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

ezi-cli - a tool on top of yargs for creating simple CLI

After installation you will be prompted to initialize the cli:

execute initialization command? (yes): yes

If you did not agree, you can initialize the CLI using:

# you can choose your file name. Supported extensions: json, yaml
$ ezi init-cli -p ./ezi-cli.json
create test scripts (yes): yes

after that you will be asked to create script files, write yes.

Once the configuration file is created, you will see something like this in it:

{
    "scripts-path": "./cli-scripts",
    "commands": {
        "test": {
            "handler": "test-cli.js",
            "description": "test ESM handler",
            "flags": {
                "your-name": {
                    "alias": "n",
                    "type": "string",
                    "description": "your-name",
                    "default": "NaN"
                }
            }
        },
        "test-commonJS": {
            "handler": "test-cli.cjs",
            "description": "test CommonJS handler",
            "flags": {
                "your-name": {
                    "alias": "n",
                    "type": "string",
                    "description": "your-name",
                    "default": "NaN"
                }
            }
        }
    }
}

You will also have files created:

// cli-scripts/test-cli.js
export default function (argv) {
    console.log(`your command: ${argv._}`);
    console.log(`your flag: ${argv['your-name']}`);
}

you can use the command to run

$ ezi test -n john

your command: test
your flag: john

If you want to change the path to your configuration file or change its name:

$ ezi change-cli [path-to-config]

After that you can simply add new commands and scripts, the scripts will receive argv from the yargs library. Just make the default export function in the scripts

1.1.1

4 months ago

1.1.0

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago

0.1.5

4 months ago

0.1.4

4 months ago

0.1.3

4 months ago

0.1.2

4 months ago

0.1.1

4 months ago

0.1.0

4 months ago