@ainc/cli
v0.1.5
Published
The complete solution for node.js command-line interfaces,
Downloads
48
Readme
@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',
},
}
});