icl

icla

Build interactive commandline apps simply and beautifully

Showing:

Popularity

Downloads/wk

3

Maintenance

No Maintenance Data Available

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

NPM

ICLA

Build interactive commandline apps simply and beautifully

Basic Usage

The barebones information that ICLA needs to make your app

// require the module (no need to assign it to a variable)
require('icla');

// example command function
function print(args){
    console.log(args);
}

// a new App
new App({
    commands: {
        print: {
            callback: print,
            desc: 'prints further arguments',
            syntax: '[args]'
        }
    }
});

If your project contains a package.json file up to two directory levels up, ICLA can figure out the name, description, and version of your program without you including it in the options Object.

More customization

If you like where ICLA is going but feel it's too bland and generic, you can tweak more options to make it feel more your own.

Description, Program Name, Prompt, and Version

As mentioned before, if any of the desc, prog, or ver properties aren't included, ICLA will attempt to find a description in your package.json. If this isn't applicable (or you want to overwrite it), use these.
As an addition, the prompt property defaults to >.

new App({
    ...
    desc: 'my new description',
    prog: 'myApp',
    prompt: '->', // a space is automatically added
    ver: '1.0.0',
    ...
});
Initial function

You have the option to specify an initial function in your app that runs before anything else.

new App({
    ...
    init: () => console.log('hello, user! Welcome!'),
    ...
});
Persistent Help

If a user inputs an invalid command in your app, you have the option of printing out the help message for them.

new App({
    ...
    pstHelp: true,
    ...
});
Another fun help fact

As of version 2.7.0, the help command can be overwritten by making a new help in options.commands. Example:

new App({
    commands: {
        help: {
            callback: () => console.log('this is kind of useless...'),
            desc: '(un)help command',
            syntax: ''
        }
    }
});
Banners

The banner option takes a string to be displayed as soon as the program is started.
patch note: As of patch 2.2.0, built in figlet support has been removed.

new App({
    ...
    banner: '============\nHello, world\n============'
    ...
});

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial