@ainc/cli
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

@ainc/cli

The complete solution for node.js command-line interfaces,

Install

$ yarn add @ainc/cli

Usage

Create commands program, as cli.js:

import { commander } from '@ainc/cli';

// create server program with 'init' and 'start' command
commander({
    name: 'server',
    usage: '[command] [options]',
    version: '0.0.1',
    description: 'web server',
    commands: {
        init: {
            description: 'init server',
        },
        start: {
            usage: '[options]',
            description: 'start server',
            isDefault: true,
        },
    },
});

Create command, as start.js:

import { command } from '@ainc/cli';

// create start server command
command({
    config: 'server.config',
    options: {
        root: {
            type: 'dir',
            alias: 'r',
            description: 'the base directory of server',
        },
        port: {
            type: 'number',
            alias: 'p',
            description: 'the port of server',
        },
        open: {
            type: 'boolean',
            description: 'open the default browser',
        },
    }
});

Package Sidebar

Install

npm i @ainc/cli

Weekly Downloads

0

Version

0.1.5

License

MIT

Unpacked Size

82.1 kB

Total Files

26

Last publish

Collaborators

  • absock
  • edonet