Sha256: 4413e72db09737abad9041de61f11dbd00e683804677a4245bd152332167d884

Contents?: true

Size: 1.39 KB

Versions: 139

Compression:

Stored size: 1.39 KB

Contents

/*:nodoc:*
 * class ActionAppendConstant
 *
 * This stores a list, and appends the value specified by
 * the const keyword argument to the list.
 * (Note that the const keyword argument defaults to null.)
 * The 'appendConst' action is typically useful when multiple
 * arguments need to store constants to the same list.
 *
 * This class inherited from [[Action]]
 **/

'use strict';

var util = require('util');

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

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

/*:nodoc:*
 * ActionAppendConstant#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
 **/
ActionAppendConstant.prototype.call = function (parser, namespace) {
  var items = [].concat(namespace[this.dest] || []);
  items.push(this.constant);
  namespace.set(this.dest, items);
};

Version data entries

139 entries across 125 versions & 8 rubygems

Version Path
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.14 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.13 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.12 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.11 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
entangled-0.0.10 spec/dummy/public/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
opal-0.7.1 stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
trans-0.5.10 template/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
trans-0.5.9 template/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js
cssesc-source-0.1.0 vendor/node_modules/grunt/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js