Sha256: 1643ef3e19b74c00d582b40614027e49ff1785d5305c399c11d071730b25da44

Contents?: true

Size: 1.29 KB

Versions: 139

Compression:

Stored size: 1.29 KB

Contents

/*:nodoc:*
 * class ActionStoreConstant
 *
 * This action stores the value specified by the const keyword argument.
 * (Note that the const keyword argument defaults to the rather unhelpful null.)
 * The 'store_const' action is most commonly used with optional
 * arguments that specify some sort of flag.
 *
 * This class inherited from [[Action]]
 **/
'use strict';

var util = require('util');

var Action = require('../../action');

/*:nodoc:*
 * new ActionStoreConstant(options)
 * - options (object): options hash see [[Action.new]]
 *
 **/
var ActionStoreConstant = module.exports = function ActionStoreConstant(options) {
  options = options || {};
  options.nargs = 0;
  if (options.constant === undefined) {
    throw new Error('constant option is required for storeAction');
  }
  Action.call(this, options);
};
util.inherits(ActionStoreConstant, Action);

/*:nodoc:*
 * ActionStoreConstant#call(parser, namespace, values, optionString) -> Void
 * - parser (ArgumentParser): current parser
 * - namespace (Namespace): namespace for output data
 * - values (Array): parsed values
 * - optionString (Array): input option string(not parsed)
 *
 * Call the action. Save result in namespace object
 **/
ActionStoreConstant.prototype.call = function (parser, namespace) {
  namespace.set(this.dest, this.constant);
};

Version data entries

139 entries across 125 versions & 8 rubygems

Version Path
ela-4.1.6 node_modules/argparse/lib/action/store/constant.js
ela-4.1.5 node_modules/argparse/lib/action/store/constant.js
ela-4.1.4 node_modules/argparse/lib/action/store/constant.js
ela-4.1.3 node_modules/argparse/lib/action/store/constant.js
ela-4.1.2 node_modules/argparse/lib/action/store/constant.js
ela-4.1.1 node_modules/argparse/lib/action/store/constant.js
ela-4.1.0 node_modules/argparse/lib/action/store/constant.js
ela-4.0.0 node_modules/argparse/lib/action/store/constant.js
opal-0.10.6 stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js
opal-0.10.6.beta stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js
ela-3.4.3 node_modules/argparse/lib/action/store/constant.js
ela-3.4.2 node_modules/argparse/lib/action/store/constant.js
ela-3.4.0 node_modules/argparse/lib/action/store/constant.js
ela-3.3.1 node_modules/argparse/lib/action/store/constant.js
ela-3.3.0 node_modules/argparse/lib/action/store/constant.js
ela-3.2.0 node_modules/argparse/lib/action/store/constant.js
ela-3.1.1 node_modules/argparse/lib/action/store/constant.js
ela-3.1.0 node_modules/argparse/lib/action/store/constant.js
ela-3.0.0 node_modules/argparse/lib/action/store/constant.js
ela-2.0.0 node_modules/argparse/lib/action/store/constant.js