Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80728 views
1
/*:nodoc:*
2
* class ActionHelp
3
*
4
* Support action for printing help
5
* This class inherided from [[Action]]
6
**/
7
'use strict';
8
9
var util = require('util');
10
11
var Action = require('../action');
12
13
// Constants
14
var $$ = require('../const');
15
16
/*:nodoc:*
17
* new ActionHelp(options)
18
* - options (object): options hash see [[Action.new]]
19
*
20
**/
21
var ActionHelp = module.exports = function ActionHelp(options) {
22
options = options || {};
23
if (options.defaultValue !== null) {
24
options.defaultValue = options.defaultValue;
25
}
26
else {
27
options.defaultValue = $$.SUPPRESS;
28
}
29
options.dest = (options.dest !== null ? options.dest: $$.SUPPRESS);
30
options.nargs = 0;
31
Action.call(this, options);
32
33
};
34
util.inherits(ActionHelp, Action);
35
36
/*:nodoc:*
37
* ActionHelp#call(parser, namespace, values, optionString)
38
* - parser (ArgumentParser): current parser
39
* - namespace (Namespace): namespace for output data
40
* - values (Array): parsed values
41
* - optionString (Array): input option string(not parsed)
42
*
43
* Print help and exit
44
**/
45
ActionHelp.prototype.call = function (parser) {
46
parser.printHelp();
47
parser.exit();
48
};
49
50