1 | # Commandico
|
2 |
|
3 | A tiny - nodejs - command line tool that allows to cleanly create a command-line client.
|
4 |
|
5 | # Usage
|
6 |
|
7 | add `commandico` to your package.json:
|
8 |
|
9 | ```
|
10 | npm i commandico --save
|
11 | ```
|
12 |
|
13 | then instanciate commadico:
|
14 |
|
15 | ```JavaScript
|
16 | var commandico = require('commandico')
|
17 | , defaultCommand = 'help'
|
18 | , scope = {
|
19 | number: 2
|
20 | };
|
21 |
|
22 | var app = commandico(scope, defaultCommand)
|
23 | ```
|
24 |
|
25 | then give it some commands
|
26 |
|
27 | ```JavaScript
|
28 | app.addCommands([{
|
29 | aliases: ['help'],
|
30 | handler: function (scope) {
|
31 | console.log(scope.number);
|
32 | }
|
33 | }])
|
34 | ```
|
35 |
|
36 | And further execute the script with some arguments
|
37 |
|
38 | ```JavaScript
|
39 | app.execute(['hello world'])
|
40 | ``` |
\ | No newline at end of file |