4 * This counts the number of times a keyword argument occurs.
5 * For example, this is useful for increasing verbosity levels
7 * This class inherided from [[Action]]
12 var util = require('util');
14 var Action = require('../action');
17 * new ActionCount(options)
18 * - options (object): options hash see [[Action.new]]
21 var ActionCount = module.exports = function ActionCount(options) {
22 options = options || {};
25 Action.call(this, options);
27 util.inherits(ActionCount, Action);
30 * ActionCount#call(parser, namespace, values, optionString) -> Void
31 * - parser (ArgumentParser): current parser
32 * - namespace (Namespace): namespace for output data
33 * - values (Array): parsed values
34 * - optionString (Array): input option string(not parsed)
36 * Call the action. Save result in namespace object
38 ActionCount.prototype.call = function (parser, namespace) {
39 namespace.set(this.dest, (namespace[this.dest] || 0) + 1);