Sha256: 3ed24a4d6d56e50d972e82b866ade25192e004d08d55cb4d5a17bf3a7c239b1a

Contents?: true

Size: 1.32 KB

Versions: 105

Compression:

Stored size: 1.32 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 c = 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 (typeof this.constant !== 'undefined' && this.nargs !== c.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

105 entries across 104 versions & 18 rubygems

Version Path
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/argparse/lib/action/store.js
disco_app-0.14.0 test/dummy/node_modules/argparse/lib/action/store.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/argparse/lib/action/store.js
appmap-0.66.2 ./node_modules/argparse/lib/action/store.js
appmap-0.66.1 ./node_modules/argparse/lib/action/store.js
appmap-0.66.0 ./node_modules/argparse/lib/action/store.js
appmap-0.65.1 ./node_modules/argparse/lib/action/store.js
appmap-0.65.0 ./node_modules/argparse/lib/action/store.js
appmap-0.64.0 ./node_modules/argparse/lib/action/store.js
appmap-0.63.0 ./node_modules/argparse/lib/action/store.js
appmap-0.62.1 ./node_modules/argparse/lib/action/store.js
tang-0.2.1 spec/tang_app/node_modules/argparse/lib/action/store.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/argparse/lib/action/store.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/argparse/lib/action/store.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/argparse/lib/action/store.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/argparse/lib/action/store.js
tang-0.2.0 spec/tang_app/node_modules/argparse/lib/action/store.js
tang-0.1.0 spec/tang_app/node_modules/argparse/lib/action/store.js
tang-0.0.9 spec/tang_app/node_modules/argparse/lib/action/store.js
enju_library-0.3.8 spec/dummy/node_modules/argparse/lib/action/store.js