Sha256: af90489b5ff5e4f01fd99b6b5161336a42955a4f3f1e00465d5b02e1ded10438

Contents?: true

Size: 721 Bytes

Versions: 139

Compression:

Stored size: 721 Bytes

Contents

#!/usr/bin/env node
'use strict';

var ArgumentParser = require('../lib/argparse').ArgumentParser;

var args;
var parent_parser = new ArgumentParser({ addHelp: false });
// note addHelp:false to prevent duplication of the -h option
parent_parser.addArgument(
  ['--parent'],
  { type: 'int', description: 'parent' }
);

var foo_parser = new ArgumentParser({
  parents: [ parent_parser ],
  description: 'child1'
});
foo_parser.addArgument(['foo']);
args = foo_parser.parseArgs(['--parent', '2', 'XXX']);
console.log(args);

var bar_parser = new ArgumentParser({
  parents: [ parent_parser ],
  description: 'child2'
});
bar_parser.addArgument(['--bar']);
args = bar_parser.parseArgs(['--bar', 'YYY']);
console.log(args);

Version data entries

139 entries across 125 versions & 8 rubygems

Version Path
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.14 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.13 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.12 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.11 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/examples/parents.js
entangled-0.0.10 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/examples/parents.js
opal-0.7.1 stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/parents.js
trans-0.5.10 template/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/examples/parents.js
trans-0.5.9 template/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/examples/parents.js
cssesc-source-0.1.0 vendor/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/examples/parents.js