dfe896868bd0f6d8a75e4c36c7232fa08548fffe
[platform/framework/web/crosswalk-tizen.git] /
1 #!/usr/bin/env node
2 'use strict';
3
4 var ArgumentParser = require('../lib/argparse').ArgumentParser;
5
6 var args;
7 var parent_parser = new ArgumentParser({ addHelp: false });
8 // note addHelp:false to prevent duplication of the -h option
9 parent_parser.addArgument(
10   ['--parent'],
11   { type: 'int', description: 'parent' }
12 );
13
14 var foo_parser = new ArgumentParser({
15   parents: [ parent_parser ],
16   description: 'child1'
17 });
18 foo_parser.addArgument(['foo']);
19 args = foo_parser.parseArgs(['--parent', '2', 'XXX']);
20 console.log(args);
21
22 var bar_parser = new ArgumentParser({
23   parents: [ parent_parser ],
24   description: 'child2'
25 });
26 bar_parser.addArgument(['--bar']);
27 args = bar_parser.parseArgs(['--bar', 'YYY']);
28 console.log(args);