{
  "name": "argparse",
  "description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library",
  "version": "0.1.15",
  "keywords": [
    "cli",
    "parser",
    "argparse",
    "option",
    "args"
  ],
  "homepage": "https://github.com/nodeca/argparse",
  "contributors": [
    {
      "name": "Eugene Shkuropat"
    },
    {
      "name": "Paul Jacobson"
    }
  ],
  "bugs": {
    "url": "https://github.com/nodeca/argparse/issues"
  },
  "license": {
    "type": "MIT",
    "url": "https://github.com/nodeca/argparse/blob/master/LICENSE"
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/nodeca/argparse.git"
  },
  "main": "./index.js",
  "scripts": {
    "test": "make test"
  },
  "dependencies": {
    "underscore": "~1.4.3",
    "underscore.string": "~2.3.1"
  },
  "devDependencies": {
    "mocha": "*"
  },
  "engines": {
    "node": ">= 0.6.0"
  },
  "readme": "argparse\n========\n\n[![Build Status](https://secure.travis-ci.org/nodeca/argparse.png?branch=master)](http://travis-ci.org/nodeca/argparse)\n\nCLI arguments parser for node.js. Javascript port of python's\n[argparse](http://docs.python.org/dev/library/argparse.html) module\n(original version 3.2). That's a full port, except some very rare options,\nrecorded in issue tracker.\n\n**NB.** Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/).\n\n\nExample\n=======\n\ntest.js file:\n\n```javascript\n#!/usr/bin/env node\n'use strict';\n\nvar ArgumentParser = require('../lib/argparse').ArgumentParser;\nvar parser = new ArgumentParser({\n  version: '0.0.1',\n  addHelp:true,\n  description: 'Argparse example'\n});\nparser.addArgument(\n  [ '-f', '--foo' ],\n  {\n    help: 'foo bar'\n  }\n);\nparser.addArgument(\n  [ '-b', '--bar' ],\n  {\n    help: 'bar foo'\n  }\n);\nvar args = parser.parseArgs();\nconsole.dir(args);\n```\n\nDisplay help:\n\n```\n$ ./test.js -h\nusage: example.js [-h] [-v] [-f FOO] [-b BAR]\n\nArgparse example\n\nOptional arguments:\n  -h, --help         Show this help message and exit.\n  -v, --version      Show program's version number and exit.\n  -f FOO, --foo FOO  foo bar\n  -b BAR, --bar BAR  bar foo\n```\n\nParse arguments:\n\n```\n$ ./test.js -f=3 --bar=4\n{ foo: '3', bar: '4' }\n```\n\nMore [examples](https://github.com/nodeca/argparse/tree/master/examples).\n\n\nArgumentParser objects\n======================\n\n```\nnew ArgumentParser({paramters hash});\n```\n\nCreates a new ArgumentParser object.\n\n**Supported params:**\n\n- ```description``` - Text to display before the argument help.\n- ```epilog``` - Text to display after the argument help.\n- ```addHelp``` - Add a -h/–help option to the parser. (default: True)\n- ```argumentDefault``` - Set the global default value for arguments. (default: None)\n- ```parents``` - A list of ArgumentParser objects whose arguments should also be included.\n- ```prefixChars``` - The set of characters that prefix optional arguments. (default: ‘-‘)\n- ```formatterClass``` - A class for customizing the help output.\n- ```prog``` - The name of the program (default: sys.argv[0])\n- ```usage``` - The string describing the program usage (default: generated)\n- ```conflictHandler``` - Usually unnecessary, defines strategy for resolving conflicting optionals.\n\n**Not supportied yet**\n\n- ```fromfilePrefixChars``` - The set of characters that prefix files from which additional arguments should be read.\n\n\nDetails in [original ArgumentParser guide](http://docs.python.org/dev/library/argparse.html#argumentparser-objects)\n\n\naddArgument() method\n====================\n\n```\nArgumentParser.addArgument([names or flags], {options})\n```\n\nDefines how a single command-line argument should be parsed.\n\n- ```name or flags``` - Either a name or a list of option strings, e.g. foo or -f, --foo.\n\nOptions:\n\n- ```action``` - The basic type of action to be taken when this argument is encountered at the command line.\n- ```nargs```- The number of command-line arguments that should be consumed.\n- ```constant``` - A constant value required by some action and nargs selections.\n- ```defaultValue``` - The value produced if the argument is absent from the command line.\n- ```type``` - The type to which the command-line argument should be converted.\n- ```choices``` - A container of the allowable values for the argument.\n- ```required``` - Whether or not the command-line option may be omitted (optionals only).\n- ```help``` - A brief description of what the argument does.\n- ```metavar``` - A name for the argument in usage messages.\n- ```dest``` - The name of the attribute to be added to the object returned by parseArgs().\n\nDetails in [original add_argument guide](http://docs.python.org/dev/library/argparse.html#the-add-argument-method)\n\n\nAction (some details)\n================\n\nArgumentParser objects associate command-line arguments with actions.\nThese actions can do just about anything with the command-line arguments associated\nwith them, though most actions simply add an attribute to the object returned by\nparseArgs(). The action keyword argument specifies how the command-line arguments\nshould be handled. The supported actions are:\n\n- ```store``` - Just stores the argument’s value. This is the default action.\n- ```storeConst``` - Stores value, specified by the const keyword argument.\n  (Note that the const keyword argument defaults to the rather unhelpful None.)\n  The 'storeConst' action is most commonly used with optional arguments, that\n  specify some sort of flag.\n- ```storeTrue``` and ```storeFalse``` - Stores values True and False\n  respectively. These are special cases of 'storeConst'.\n- ```append``` - Stores a list, and appends each argument value to the list.\n  This is useful to allow an option to be specified multiple times.\n- ```appendConst``` - Stores a list, and appends value, specified by the\n  const keyword argument to the list. (Note, that the const keyword argument defaults\n  is None.) The 'appendConst' action is typically used when multiple arguments need\n  to store constants to the same list.\n- ```count``` - Counts the number of times a keyword argument occurs. For example,\n  used for increasing verbosity levels.\n- ```help``` - Prints a complete help message for all the options in the current\n  parser and then exits. By default a help action is automatically added to the parser.\n  See ArgumentParser for details of how the output is created.\n- ```version``` - Prints version information and exit. Expects a `version=`\n  keyword argument in the addArgument() call.\n\nDetails in [original action guide](http://docs.python.org/dev/library/argparse.html#action)\n\n\nSub-commands\n============\n\nArgumentParser.addSubparsers()\n\nMany programs split their functionality into a number of sub-commands, for\nexample, the svn program can invoke sub-commands like `svn checkout`, `svn update`,\nand `svn commit`. Splitting up functionality this way can be a particularly good\nidea when a program performs several different functions which require different\nkinds of command-line arguments. `ArgumentParser` supports creation of such\nsub-commands with `addSubparsers()` method. The `addSubparsers()` method is\nnormally called with no arguments and returns an special action object.\nThis object has a single method `addParser()`, which takes a command name and\nany `ArgumentParser` constructor arguments, and returns an `ArgumentParser` object\nthat can be modified as usual.\n\nExample:\n\nsub_commands.js\n```javascript\n#!/usr/bin/env node\n'use strict';\n\nvar ArgumentParser = require('../lib/argparse').ArgumentParser;\nvar parser = new ArgumentParser({\n  version: '0.0.1',\n  addHelp:true,\n  description: 'Argparse examples: sub-commands',\n});\n\nvar subparsers = parser.addSubparsers({\n  title:'subcommands',\n  dest:\"subcommand_name\"\n});\n\nvar bar = subparsers.addParser('c1', {addHelp:true});\nbar.addArgument(\n  [ '-f', '--foo' ],\n  {\n    action: 'store',\n    help: 'foo3 bar3'\n  }\n);\nvar bar = subparsers.addParser(\n  'c2',\n  {aliases:['co'], addHelp:true}\n);\nbar.addArgument(\n  [ '-b', '--bar' ],\n  {\n    action: 'store',\n    type: 'int',\n    help: 'foo3 bar3'\n  }\n);\n\nvar args = parser.parseArgs();\nconsole.dir(args);\n\n```\n\nDetails in [original sub-commands guide](http://docs.python.org/dev/library/argparse.html#sub-commands)\n\n\nContributors\n============\n\n- [Eugene Shkuropat](https://github.com/shkuropat)\n- [Paul Jacobson](https://github.com/hpaulj)\n\n[others](https://github.com/nodeca/argparse/graphs/contributors)\n\nLicense\n=======\n\nCopyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin).\nReleased under the MIT license. See\n[LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details.\n\n\n",
  "readmeFilename": "README.md",
  "_id": "argparse@0.1.15",
  "_from": "argparse@0.1.15"
}
