Sha256: 4e7f5cb51871268a1b5dc60e269db22f556baca4e974bd763e59267ae26ca2e2

Contents?: true

Size: 1.31 KB

Versions: 139

Compression:

Stored size: 1.31 KB

Contents

/*:nodoc:*
 * class ActionStore
 *
 * This action just stores the argument’s value. This is the default action.
 *
 * This class inherited from [[Action]]
 *
 **/
'use strict';

var util = require('util');

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

// Constants
var $$ = require('../const');


/*:nodoc:*
 * new ActionStore(options)
 * - options (object): options hash see [[Action.new]]
 *
 **/
var ActionStore = module.exports = function ActionStore(options) {
  options = options || {};
  if (this.nargs <= 0) {
    throw new Error('nargs for store actions must be > 0; if you ' +
        'have nothing to store, actions such as store ' +
        'true or store const may be more appropriate');

  }
  if (this.constant !== undefined && this.nargs !== $$.OPTIONAL) {
    throw new Error('nargs must be OPTIONAL to supply const');
  }
  Action.call(this, options);
};
util.inherits(ActionStore, Action);

/*:nodoc:*
 * ActionStore#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
 **/
ActionStore.prototype.call = function (parser, namespace, values) {
  namespace.set(this.dest, values);
};

Version data entries

139 entries across 125 versions & 8 rubygems

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