No Description

choice.js 449B

12345678910111213141516171819202122
  1. #!/usr/bin/env node
  2. 'use strict';
  3. var ArgumentParser = require('../lib/argparse').ArgumentParser;
  4. var parser = new ArgumentParser({
  5. version: '0.0.1',
  6. addHelp: true,
  7. description: 'Argparse examples: choice'
  8. });
  9. parser.addArgument(['foo'], {choices: 'abc'});
  10. parser.printHelp();
  11. console.log('-----------');
  12. var args;
  13. args = parser.parseArgs(['c']);
  14. console.dir(args);
  15. console.log('-----------');
  16. parser.parseArgs(['X']);
  17. console.dir(args);