How to use the argparse.RawDescriptionHelpFormatter 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
-h, --help  show this help message and exit
  --foo FOO   foo help - oh and by the way, null
  --bar       bar help (default: false)

title:
  group description

  --baz BAZ   baz help (default: 42)
*/

print("TEST argparse.RawDescriptionHelpFormatter");

parser = new argparse.ArgumentParser({
  debug: true,
  prog: 'PROG',
  formatterClass: argparse.RawDescriptionHelpFormatter,
  description: 'Keep the formatting\n' +
               '    exactly as it is written\n' +
               '\n' +
               'here\n'
});

a = parser.addArgument(['--foo'], {
  help: '  foo help should not\n' +
        '    retain this odd formatting'
});

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

group = parser.addArgumentGroup({
github nodeca / argparse / examples / testformatters.js View on Github external
-h, --help  show this help message and exit
  --foo FOO   foo help - oh and by the way, null
  --bar       bar help (default: false)

title:
  group description

  --baz BAZ   baz help (default: 42)
*/

print('TEST argparse.RawDescriptionHelpFormatter');

parser = new argparse.ArgumentParser({
  debug: true,
  prog: 'PROG',
  formatterClass: argparse.RawDescriptionHelpFormatter,
  description: 'Keep the formatting\n' +
               '    exactly as it is written\n' +
               '\n' +
               'here\n'
});

a = parser.addArgument([ '--foo' ], {
  help: '  foo help should not\n' +
        '    retain this odd formatting'
});

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

group = parser.addArgumentGroup({
github jfjlaros / bin-parser / javascript / cli.js View on Github external
function main() {
  var optParser = new argparse.ArgumentParser({addHelp: false}),
      parser = new argparse.ArgumentParser({
        version: distMeta.version,
        addHelp: true,
        description: distMeta.description,
        epilog: "Copyright (c) " + distMeta.year + " " + distMeta.author +
          "\n\nLicensed under the " + distMeta.license +
          " license, see the LICENSE file.",
        formatterClass: argparse.RawDescriptionHelpFormatter
      }),
      subparsers = parser.addSubparsers({
        title:"subcommands",
        dest:"subcommand_name"
      }),
      readParser,
      args;

  optParser.addArgument(["inputFile"], {help: "Input file"});
  optParser.addArgument(
    ["structureFile"], {help: "Structure definition file"});
  optParser.addArgument(["typesFile"], {help: "Type definition file"});
  optParser.addArgument(["outputFile"], {help: "Output file"});
  optParser.addArgument(
    ["-d"], {
      dest: "debug",