1.1.0 • Published 11 months ago

lil-cli v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Lil-CLI

A lightweight lib that makes more easier to create a CLI (Command Line Interface), with your own commands and it custom params, that can be easily validated too.

How to use:

You just need to register the commands that your application will have and configure the validators of the params, if it have.

For example:

import CLI from 'lil-cli';
// Initialize passing the process arguments
const cli = new CLI(process.argv);

// Create command config
const config = {
    description: 'Send a message',
    model: [
        {
            name: 'say',
            join: true
        }
    ]
}
// Register command
cli.registerCommand('say', config, (err, params) => {
    console.log(params.message);
});


// If you want, you can register an callback if no command is found.
// cli.on('notFindAnyCommand', () => {
//     console.log('No command found.')
// });

cli.listen();

Examples

Download

If you're using npm, run in your project:

npm install lil-cli

or if you're using yarn:

yarn add lil-cli

How to run examples

cd ./examples
npm install
// choose one of examples, ex:
npm run start-password-generator
1.1.0

11 months ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago