How to use the argparse.ArgumentDefaultsHelpFormatter function in argparse

To help you get started, we’ve selected a few argparse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypeStrong / atom-typescript / node_modules / tsconfig / node_modules / js-yaml / node_modules / argparse / examples / testformatters.js View on Github external
var assert = require('assert');
var _ = require('underscore');
_.str = require('underscore.string');
var print = function () {
    return console.log.apply(console, arguments);
  };
// print = function () {};

var argparse = require('argparse');

print("TEST argparse.ArgumentDefaultsHelpFormatter");

parser = new argparse.ArgumentParser({
  debug: true,
  formatterClass: argparse.ArgumentDefaultsHelpFormatter,
  description: 'description'
});

parser.addArgument(['--foo'], {
  help: 'foo help - oh and by the way, %(defaultValue)s'
});

parser.addArgument(['--bar'], {
  action: 'storeTrue',
  help: 'bar help'
});

parser.addArgument(['spam'], {
  help: 'spam help'
});
github nodeca / argparse / examples / testformatters.js View on Github external
var assert = require('assert');


function print() {
  return console.log.apply(console, arguments);
}
// print = function () {};

var argparse = require('argparse');

print('TEST argparse.ArgumentDefaultsHelpFormatter');

parser = new argparse.ArgumentParser({
  debug: true,
  formatterClass: argparse.ArgumentDefaultsHelpFormatter,
  description: 'description'
});

parser.addArgument([ '--foo' ], {
  help: 'foo help - oh and by the way, %(defaultValue)s'
});

parser.addArgument([ '--bar' ], {
  action: 'storeTrue',
  help: 'bar help'
});

parser.addArgument([ 'spam' ], {
  help: 'spam help'
});