aboutsummaryrefslogtreecommitdiff
path: root/node_modules/argparse/lib/action/count.js
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 21:37:45 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2019-10-06 21:37:45 +0200
commit3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch)
treec7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/argparse/lib/action/count.js
parent412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff)
downloadwebsite-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz
website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip
build: Add some required modules for node
Diffstat (limited to 'node_modules/argparse/lib/action/count.js')
-rw-r--r--node_modules/argparse/lib/action/count.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/node_modules/argparse/lib/action/count.js b/node_modules/argparse/lib/action/count.js
new file mode 100644
index 0000000..d6a5899
--- /dev/null
+++ b/node_modules/argparse/lib/action/count.js
@@ -0,0 +1,40 @@
+/*: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);
+};