aboutsummaryrefslogtreecommitdiff
path: root/node_modules/argparse/lib/action
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/argparse/lib/action')
-rw-r--r--node_modules/argparse/lib/action/append.js53
-rw-r--r--node_modules/argparse/lib/action/append/constant.js47
-rw-r--r--node_modules/argparse/lib/action/count.js40
-rw-r--r--node_modules/argparse/lib/action/help.js47
-rw-r--r--node_modules/argparse/lib/action/store.js50
-rw-r--r--node_modules/argparse/lib/action/store/constant.js43
-rw-r--r--node_modules/argparse/lib/action/store/false.js27
-rw-r--r--node_modules/argparse/lib/action/store/true.js26
-rw-r--r--node_modules/argparse/lib/action/subparsers.js149
-rw-r--r--node_modules/argparse/lib/action/version.js47
10 files changed, 0 insertions, 529 deletions
diff --git a/node_modules/argparse/lib/action/append.js b/node_modules/argparse/lib/action/append.js
deleted file mode 100644
index b5da0de23..000000000
--- a/node_modules/argparse/lib/action/append.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*:nodoc:*
- * class ActionAppend
- *
- * This action stores a list, and appends each argument value to the list.
- * This is useful to allow an option to be specified multiple times.
- * This class inherided from [[Action]]
- *
- **/
-
-'use strict';
-
-var util = require('util');
-
-var Action = require('../action');
-
-// Constants
-var c = require('../const');
-
-/*:nodoc:*
- * new ActionAppend(options)
- * - options (object): options hash see [[Action.new]]
- *
- * Note: options.nargs should be optional for constants
- * and more then zero for other
- **/
-var ActionAppend = module.exports = function ActionAppend(options) {
- options = options || {};
- if (this.nargs <= 0) {
- throw new Error('nargs for append actions must be > 0; if arg ' +
- 'strings are not supplying the value to append, ' +
- 'the append const action may be more appropriate');
- }
- if (!!this.constant && this.nargs !== c.OPTIONAL) {
- throw new Error('nargs must be OPTIONAL to supply const');
- }
- Action.call(this, options);
-};
-util.inherits(ActionAppend, Action);
-
-/*:nodoc:*
- * ActionAppend#call(parser, namespace, values, optionString) -> Void
- * - parser (ArgumentParser): current parser
- * - namespace (Namespace): namespace for output data
- * - values (Array): parsed values
- * - optionString (Array): input option string(not parsed)
- *
- * Call the action. Save result in namespace object
- **/
-ActionAppend.prototype.call = function (parser, namespace, values) {
- var items = (namespace[this.dest] || []).slice();
- items.push(values);
- namespace.set(this.dest, items);
-};
diff --git a/node_modules/argparse/lib/action/append/constant.js b/node_modules/argparse/lib/action/append/constant.js
deleted file mode 100644
index 313f5d2ef..000000000
--- a/node_modules/argparse/lib/action/append/constant.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*:nodoc:*
- * class ActionAppendConstant
- *
- * This stores a list, and appends the value specified by
- * the const keyword argument to the list.
- * (Note that the const keyword argument defaults to null.)
- * The 'appendConst' action is typically useful when multiple
- * arguments need to store constants to the same list.
- *
- * This class inherited from [[Action]]
- **/
-
-'use strict';
-
-var util = require('util');
-
-var Action = require('../../action');
-
-/*:nodoc:*
- * new ActionAppendConstant(options)
- * - options (object): options hash see [[Action.new]]
- *
- **/
-var ActionAppendConstant = module.exports = function ActionAppendConstant(options) {
- options = options || {};
- options.nargs = 0;
- if (typeof options.constant === 'undefined') {
- throw new Error('constant option is required for appendAction');
- }
- Action.call(this, options);
-};
-util.inherits(ActionAppendConstant, Action);
-
-/*:nodoc:*
- * ActionAppendConstant#call(parser, namespace, values, optionString) -> Void
- * - parser (ArgumentParser): current parser
- * - namespace (Namespace): namespace for output data
- * - values (Array): parsed values
- * - optionString (Array): input option string(not parsed)
- *
- * Call the action. Save result in namespace object
- **/
-ActionAppendConstant.prototype.call = function (parser, namespace) {
- var items = [].concat(namespace[this.dest] || []);
- items.push(this.constant);
- namespace.set(this.dest, items);
-};
diff --git a/node_modules/argparse/lib/action/count.js b/node_modules/argparse/lib/action/count.js
deleted file mode 100644
index d6a5899d0..000000000
--- a/node_modules/argparse/lib/action/count.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/*:nodoc:*
- * class ActionCount
- *
- * This counts the number of times a keyword argument occurs.
- * For example, this is useful for increasing verbosity levels
- *
- * This class inherided from [[Action]]
- *
- **/
-'use strict';
-
-var util = require('util');
-
-var Action = require('../action');
-
-/*:nodoc:*
- * new ActionCount(options)
- * - options (object): options hash see [[Action.new]]
- *
- **/
-var ActionCount = module.exports = function ActionCount(options) {
- options = options || {};
- options.nargs = 0;
-
- Action.call(this, options);
-};
-util.inherits(ActionCount, Action);
-
-/*:nodoc:*
- * ActionCount#call(parser, namespace, values, optionString) -> Void
- * - parser (ArgumentParser): current parser
- * - namespace (Namespace): namespace for output data
- * - values (Array): parsed values
- * - optionString (Array): input option string(not parsed)
- *
- * Call the action. Save result in namespace object
- **/
-ActionCount.prototype.call = function (parser, namespace) {
- namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
-};
diff --git a/node_modules/argparse/lib/action/help.js b/node_modules/argparse/lib/action/help.js
deleted file mode 100644
index b40e05a6f..000000000
--- a/node_modules/argparse/lib/action/help.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*:nodoc:*
- * class ActionHelp
- *
- * Support action for printing help
- * This class inherided from [[Action]]
- **/
-'use strict';
-
-var util = require('util');
-
-var Action = require('../action');
-
-// Constants
-var c = require('../const');
-
-/*:nodoc:*
- * new ActionHelp(options)
- * - options (object): options hash see [[Action.new]]
- *
- **/
-var ActionHelp = module.exports = function ActionHelp(options) {
- options = options || {};
- if (options.defaultValue !== null) {
- options.defaultValue = options.defaultValue;
- } else {
- options.defaultValue = c.SUPPRESS;
- }
- options.dest = (options.dest !== null ? options.dest : c.SUPPRESS);
- options.nargs = 0;
- Action.call(this, options);
-
-};
-util.inherits(ActionHelp, Action);
-
-/*:nodoc:*
- * ActionHelp#call(parser, namespace, values, optionString)
- * - parser (ArgumentParser): current parser
- * - namespace (Namespace): namespace for output data
- * - values (Array): parsed values
- * - optionString (Array): input option string(not parsed)
- *
- * Print help and exit
- **/
-ActionHelp.prototype.call = function (parser) {
- parser.printHelp();
- parser.exit();
-};
diff --git a/node_modules/argparse/lib/action/store.js b/node_modules/argparse/lib/action/store.js
deleted file mode 100644
index 283b86092..000000000
--- a/node_modules/argparse/lib/action/store.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/*:nodoc:*
- * class ActionStore
- *
- * This action just stores the argument’s value. This is the default action.
- *
- * This class inherited from [[Action]]
- *
- **/
-'use strict';
-
-var util = require('util');
-
-var Action = require('../action');
-
-// Constants
-var c = require('../const');
-
-
-/*:nodoc:*
- * new ActionStore(options)
- * - options (object): options hash see [[Action.new]]
- *
- **/
-var ActionStore = module.exports = function ActionStore(options) {
- options = options || {};
- if (this.nargs <= 0) {
- throw new Error('nargs for store actions must be > 0; if you ' +
- 'have nothing to store, actions such as store ' +
- 'true or store const may be more appropriate');
-
- }
- if (typeof this.constant !== 'undefined' && this.nargs !== c.OPTIONAL) {
- throw new Error('nargs must be OPTIONAL to supply const');
- }
- Action.call(this, options);
-};
-util.inherits(ActionStore, Action);
-
-/*:nodoc:*
- * ActionStore#call(parser, namespace, values, optionString) -> Void
- * - parser (ArgumentParser): current parser
- * - namespace (Namespace): namespace for output data
- * - values (Array): parsed values
- * - optionString (Array): input option string(not parsed)
- *
- * Call the action. Save result in namespace object
- **/
-ActionStore.prototype.call = function (parser, namespace, values) {
- namespace.set(this.dest, values);
-};
diff --git a/node_modules/argparse/lib/action/store/constant.js b/node_modules/argparse/lib/action/store/constant.js
deleted file mode 100644
index 23caa897b..000000000
--- a/node_modules/argparse/lib/action/store/constant.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*:nodoc:*
- * class ActionStoreConstant
- *
- * This action stores the value specified by the const keyword argument.
- * (Note that the const keyword argument defaults to the rather unhelpful null.)
- * The 'store_const' action is most commonly used with optional
- * arguments that specify some sort of flag.
- *
- * This class inherited from [[Action]]
- **/
-'use strict';
-
-var util = require('util');
-
-var Action = require('../../action');
-
-/*:nodoc:*
- * new ActionStoreConstant(options)
- * - options (object): options hash see [[Action.new]]
- *
- **/
-var ActionStoreConstant = module.exports = function ActionStoreConstant(options) {
- options = options || {};
- options.nargs = 0;
- if (typeof options.constant === 'undefined') {
- throw new Error('constant option is required for storeAction');
- }
- Action.call(this, options);
-};
-util.inherits(ActionStoreConstant, Action);
-
-/*:nodoc:*
- * ActionStoreConstant#call(parser, namespace, values, optionString) -> Void
- * - parser (ArgumentParser): current parser
- * - namespace (Namespace): namespace for output data
- * - values (Array): parsed values
- * - optionString (Array): input option string(not parsed)
- *
- * Call the action. Save result in namespace object
- **/
-ActionStoreConstant.prototype.call = function (parser, namespace) {
- namespace.set(this.dest, this.constant);
-};
diff --git a/node_modules/argparse/lib/action/store/false.js b/node_modules/argparse/lib/action/store/false.js
deleted file mode 100644
index 9924f461d..000000000
--- a/node_modules/argparse/lib/action/store/false.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/*:nodoc:*
- * class ActionStoreFalse
- *
- * This action store the values False respectively.
- * This is special cases of 'storeConst'
- *
- * This class inherited from [[Action]]
- **/
-
-'use strict';
-
-var util = require('util');
-
-var ActionStoreConstant = require('./constant');
-
-/*:nodoc:*
- * new ActionStoreFalse(options)
- * - options (object): hash of options see [[Action.new]]
- *
- **/
-var ActionStoreFalse = module.exports = function ActionStoreFalse(options) {
- options = options || {};
- options.constant = false;
- options.defaultValue = options.defaultValue !== null ? options.defaultValue : true;
- ActionStoreConstant.call(this, options);
-};
-util.inherits(ActionStoreFalse, ActionStoreConstant);
diff --git a/node_modules/argparse/lib/action/store/true.js b/node_modules/argparse/lib/action/store/true.js
deleted file mode 100644
index 9e22f7d44..000000000
--- a/node_modules/argparse/lib/action/store/true.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*:nodoc:*
- * class ActionStoreTrue
- *
- * This action store the values True respectively.
- * This isspecial cases of 'storeConst'
- *
- * This class inherited from [[Action]]
- **/
-'use strict';
-
-var util = require('util');
-
-var ActionStoreConstant = require('./constant');
-
-/*:nodoc:*
- * new ActionStoreTrue(options)
- * - options (object): options hash see [[Action.new]]
- *
- **/
-var ActionStoreTrue = module.exports = function ActionStoreTrue(options) {
- options = options || {};
- options.constant = true;
- options.defaultValue = options.defaultValue !== null ? options.defaultValue : false;
- ActionStoreConstant.call(this, options);
-};
-util.inherits(ActionStoreTrue, ActionStoreConstant);
diff --git a/node_modules/argparse/lib/action/subparsers.js b/node_modules/argparse/lib/action/subparsers.js
deleted file mode 100644
index 99dfedd0f..000000000
--- a/node_modules/argparse/lib/action/subparsers.js
+++ /dev/null
@@ -1,149 +0,0 @@
-/** internal
- * class ActionSubparsers
- *
- * Support the creation of such sub-commands with the addSubparsers()
- *
- * This class inherited from [[Action]]
- **/
-'use strict';
-
-var util = require('util');
-var format = require('util').format;
-
-
-var Action = require('../action');
-
-// Constants
-var c = require('../const');
-
-// Errors
-var argumentErrorHelper = require('../argument/error');
-
-
-/*:nodoc:*
- * new ChoicesPseudoAction(name, help)
- *
- * Create pseudo action for correct help text
- *
- **/
-function ChoicesPseudoAction(name, help) {
- var options = {
- optionStrings: [],
- dest: name,
- help: help
- };
-
- Action.call(this, options);
-}
-
-util.inherits(ChoicesPseudoAction, Action);
-
-/**
- * new ActionSubparsers(options)
- * - options (object): options hash see [[Action.new]]
- *
- **/
-function ActionSubparsers(options) {
- options = options || {};
- options.dest = options.dest || c.SUPPRESS;
- options.nargs = c.PARSER;
-
- this.debug = (options.debug === true);
-
- this._progPrefix = options.prog;
- this._parserClass = options.parserClass;
- this._nameParserMap = {};
- this._choicesActions = [];
-
- options.choices = this._nameParserMap;
- Action.call(this, options);
-}
-
-util.inherits(ActionSubparsers, Action);
-
-/*:nodoc:*
- * ActionSubparsers#addParser(name, options) -> ArgumentParser
- * - name (string): sub-command name
- * - options (object): see [[ArgumentParser.new]]
- *
- * Note:
- * addParser supports an additional aliases option,
- * which allows multiple strings to refer to the same subparser.
- * This example, like svn, aliases co as a shorthand for checkout
- *
- **/
-ActionSubparsers.prototype.addParser = function (name, options) {
- var parser;
-
- var self = this;
-
- options = options || {};
-
- options.debug = (this.debug === true);
-
- // set program from the existing prefix
- if (!options.prog) {
- options.prog = this._progPrefix + ' ' + name;
- }
-
- var aliases = options.aliases || [];
-
- // create a pseudo-action to hold the choice help
- if (!!options.help || typeof options.help === 'string') {
- var help = options.help;
- delete options.help;
-
- var choiceAction = new ChoicesPseudoAction(name, help);
- this._choicesActions.push(choiceAction);
- }
-
- // create the parser and add it to the map
- parser = new this._parserClass(options);
- this._nameParserMap[name] = parser;
-
- // make parser available under aliases also
- aliases.forEach(function (alias) {
- self._nameParserMap[alias] = parser;
- });
-
- return parser;
-};
-
-ActionSubparsers.prototype._getSubactions = function () {
- return this._choicesActions;
-};
-
-/*:nodoc:*
- * ActionSubparsers#call(parser, namespace, values, optionString) -> Void
- * - parser (ArgumentParser): current parser
- * - namespace (Namespace): namespace for output data
- * - values (Array): parsed values
- * - optionString (Array): input option string(not parsed)
- *
- * Call the action. Parse input aguments
- **/
-ActionSubparsers.prototype.call = function (parser, namespace, values) {
- var parserName = values[0];
- var argStrings = values.slice(1);
-
- // set the parser name if requested
- if (this.dest !== c.SUPPRESS) {
- namespace[this.dest] = parserName;
- }
-
- // select the parser
- if (this._nameParserMap[parserName]) {
- parser = this._nameParserMap[parserName];
- } else {
- throw argumentErrorHelper(format(
- 'Unknown parser "%s" (choices: [%s]).',
- parserName,
- Object.keys(this._nameParserMap).join(', ')
- ));
- }
-
- // parse all the remaining options into the namespace
- parser.parseArgs(argStrings, namespace);
-};
-
-module.exports = ActionSubparsers;
diff --git a/node_modules/argparse/lib/action/version.js b/node_modules/argparse/lib/action/version.js
deleted file mode 100644
index 8053328cd..000000000
--- a/node_modules/argparse/lib/action/version.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*:nodoc:*
- * class ActionVersion
- *
- * Support action for printing program version
- * This class inherited from [[Action]]
- **/
-'use strict';
-
-var util = require('util');
-
-var Action = require('../action');
-
-//
-// Constants
-//
-var c = require('../const');
-
-/*:nodoc:*
- * new ActionVersion(options)
- * - options (object): options hash see [[Action.new]]
- *
- **/
-var ActionVersion = module.exports = function ActionVersion(options) {
- options = options || {};
- options.defaultValue = (options.defaultValue ? options.defaultValue : c.SUPPRESS);
- options.dest = (options.dest || c.SUPPRESS);
- options.nargs = 0;
- this.version = options.version;
- Action.call(this, options);
-};
-util.inherits(ActionVersion, Action);
-
-/*:nodoc:*
- * ActionVersion#call(parser, namespace, values, optionString) -> Void
- * - parser (ArgumentParser): current parser
- * - namespace (Namespace): namespace for output data
- * - values (Array): parsed values
- * - optionString (Array): input option string(not parsed)
- *
- * Print version and exit
- **/
-ActionVersion.prototype.call = function (parser) {
- var version = this.version || parser.version;
- var formatter = parser._getFormatter();
- formatter.addText(version);
- parser.exit(0, formatter.formatHelp());
-};