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.

help.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*:nodoc:*
  2. * class ActionHelp
  3. *
  4. * Support action for printing help
  5. * This class inherided from [[Action]]
  6. **/
  7. 'use strict';
  8. var util = require('util');
  9. var Action = require('../action');
  10. // Constants
  11. var c = require('../const');
  12. /*:nodoc:*
  13. * new ActionHelp(options)
  14. * - options (object): options hash see [[Action.new]]
  15. *
  16. **/
  17. var ActionHelp = module.exports = function ActionHelp(options) {
  18. options = options || {};
  19. if (options.defaultValue !== null) {
  20. options.defaultValue = options.defaultValue;
  21. } else {
  22. options.defaultValue = c.SUPPRESS;
  23. }
  24. options.dest = (options.dest !== null ? options.dest : c.SUPPRESS);
  25. options.nargs = 0;
  26. Action.call(this, options);
  27. };
  28. util.inherits(ActionHelp, Action);
  29. /*:nodoc:*
  30. * ActionHelp#call(parser, namespace, values, optionString)
  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. * Print help and exit
  37. **/
  38. ActionHelp.prototype.call = function (parser) {
  39. parser.printHelp();
  40. parser.exit();
  41. };