coa 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
package/tests/api-cmd.js DELETED
@@ -1,27 +0,0 @@
1
- var program = require('../lib/coa').Cmd()
2
- .name('cmd')
3
- .title('Command test')
4
- .helpful()
5
- .cmd()
6
- .name('command')
7
- .title('Do command work')
8
- .helpful()
9
- .cmd()
10
- .name('subcommand')
11
- .title('Do subcommand work')
12
- .helpful()
13
- .act(function() {
14
- console.log('Doing subcommand work...');
15
- })
16
- .end()
17
- .act(function() {
18
- console.log('Doing a lot of command work...');
19
- })
20
- .end()
21
- .act(function() {
22
- console.log('Doing nothing...');
23
- });
24
-
25
- program.api().end();
26
- program.api.command().end();
27
- program.api.command.subcommand().end();
package/tests/args.js DELETED
@@ -1,21 +0,0 @@
1
- var argv = process.argv.slice(2);
2
- require('../lib/coa').Cmd()
3
- .name('arg')
4
- .title('Args test')
5
- .helpful()
6
- .opt()
7
- .name('opt').title('Option')
8
- .long('opt').short('o')
9
- .end()
10
- .arg()
11
- .name('arg1').title('First arg')
12
- .end()
13
- .arg()
14
- .name('arg2').title('Second array arg')
15
- .arr()
16
- .end()
17
- .act(function(opts, args) {
18
- console.log(opts);
19
- console.log(args);
20
- })
21
- .run(argv.length? argv : ['-o', 'value', 'value', 'value 1', 'value 2']);
package/tests/cmd.js DELETED
@@ -1,14 +0,0 @@
1
- var argv = process.argv.slice(2);
2
- require('../lib/coa').Cmd()
3
- .name('cmd')
4
- .title('Command test')
5
- .helpful()
6
- .cmd()
7
- .name('command')
8
- .title('Do command work')
9
- .helpful()
10
- .act(function() {
11
- console.log('Doing command work...');
12
- })
13
- .end()
14
- .run(argv.length? argv : ['command']);
package/tests/def.js DELETED
@@ -1,25 +0,0 @@
1
- var argv = process.argv.slice(2);
2
- require('../lib/coa').Cmd()
3
- .name('def')
4
- .title('Default value test')
5
- .helpful()
6
- .opt()
7
- .name('a').title('Value A')
8
- .short('a')
9
- .def('aaa')
10
- .act(function(opts) {
11
- console.log('a=' + opts.a);
12
- })
13
- .end()
14
- .opt()
15
- .name('b').title('Value B')
16
- .short('b')
17
- .def('bbb')
18
- .act(function(opts) {
19
- console.log('b=' + opts.b);
20
- })
21
- .end()
22
- .act(function(opts) {
23
- console.log(opts);
24
- })
25
- .run(argv.length? argv : ['-a', '1']);
package/tests/l.js DELETED
@@ -1,21 +0,0 @@
1
- var argv = process.argv.slice(2);
2
- require('../lib/coa').Cmd()
3
- .name('bla')
4
- .title('Bla bla bla')
5
- .helpful()
6
- .opt()
7
- .name('long1').title('Long1')
8
- .short('l').long('long1')
9
- .act(function(opts) {
10
- console.log(opts.long1);
11
- })
12
- .end()
13
- .opt()
14
- .name('long2').title('Long2')
15
- .short('L').long('long2')
16
- .act(function(opts) {
17
- console.log(opts.long2);
18
- })
19
- .end()
20
- .act(function(opts) { console.log(opts) })
21
- .run(argv.length? argv : ['--long1', '111', '--long2', '222']);
package/tests/rarg.js DELETED
@@ -1,13 +0,0 @@
1
- var argv = process.argv.slice(2);
2
- require('../lib/coa').Cmd()
3
- .name('rarg')
4
- .title('Raw arg test')
5
- .helpful()
6
- .arg()
7
- .name('raw').title('Raw arg')
8
- .arr()
9
- .end()
10
- .act(function(opts, args) {
11
- console.log(args);
12
- })
13
- .run(argv.length? argv : ['--', 'raw', 'arg', 'values']);
package/tests/req.js DELETED
@@ -1,10 +0,0 @@
1
- require('../lib/coa').Cmd()
2
- .name('req')
3
- .title('Bla bla bla')
4
- .helpful()
5
- .opt()
6
- .name('bla').title('Bla')
7
- .short('b').long('bla')
8
- .req()
9
- .end()
10
- .run();
package/tests/v.js DELETED
@@ -1,23 +0,0 @@
1
- var argv = process.argv.slice(2);
2
- require('../lib/coa').Cmd()
3
- .name('bla')
4
- .title('Bla bla bla')
5
- .helpful()
6
- .opt()
7
- .name('version').title('Version')
8
- .short('v').long('version')
9
- .flag()
10
- .only()
11
- .act(function(opts, args) {
12
- return require('../package.json').version;
13
- })
14
- .end()
15
- .opt()
16
- .name('req').title('Required')
17
- .short('r').long('long')
18
- .req()
19
- .end()
20
- .act(function() {
21
- console.log('... doing hard work ...')
22
- })
23
- .run(argv.length? argv : ['-v']);
package/tests/val.js DELETED
@@ -1,14 +0,0 @@
1
- var argv = process.argv.slice(2);
2
- require('../lib/coa').Cmd()
3
- .name('val')
4
- .title('Val test')
5
- .helpful()
6
- .opt()
7
- .name('bla').title('Bla')
8
- .short('b').long('bla')
9
- .val(function(v) { return { value: v } })
10
- .act(function(opts) {
11
- console.log(opts.bla);
12
- })
13
- .end()
14
- .run(argv.length? argv : ['--bla=blabla']);