Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

count.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. var util = require('util');
  12. var Action = require('../action');
  13. /*:nodoc:*
  14. * new ActionCount(options)
  15. * - options (object): options hash see [[Action.new]]
  16. *
  17. **/
  18. var ActionCount = module.exports = function ActionCount(options) {
  19. options = options || {};
  20. options.nargs = 0;
  21. Action.call(this, options);
  22. };
  23. util.inherits(ActionCount, Action);
  24. /*:nodoc:*
  25. * ActionCount#call(parser, namespace, values, optionString) -> Void
  26. * - parser (ArgumentParser): current parser
  27. * - namespace (Namespace): namespace for output data
  28. * - values (Array): parsed values
  29. * - optionString (Array): input option string(not parsed)
  30. *
  31. * Call the action. Save result in namespace object
  32. **/
  33. ActionCount.prototype.call = function (parser, namespace) {
  34. namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
  35. };