UNPKG

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