.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / argparse / lib / action / count.js
1 /*:nodoc:*
2  * class ActionCount
3  *
4  * This counts the number of times a keyword argument occurs.
5  * For example, this is useful for increasing verbosity levels
6  *
7  * This class inherided from [[Action]]
8  *
9  **/
10 'use strict';
11
12 var util = require('util');
13
14 var Action = require('../action');
15
16 /*:nodoc:*
17  * new ActionCount(options)
18  * - options (object): options hash see [[Action.new]]
19  *
20  **/
21 var ActionCount = module.exports = function ActionCount(options) {
22   options = options || {};
23   options.nargs = 0;
24
25   Action.call(this, options);
26 };
27 util.inherits(ActionCount, Action);
28
29 /*:nodoc:*
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)
35  *
36  * Call the action. Save result in namespace object
37  **/
38 ActionCount.prototype.call = function (parser, namespace) {
39   namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
40 };