BVB Source Codes

reactide Show exclusive.js Source code

Return Download reactide: download exclusive.js Source code - Download reactide Source code - Type:.js
  1. /** internal
  2.  * class MutuallyExclusiveGroup
  3.  *
  4.  * Group arguments.
  5.  * By default, ArgumentParser groups command-line arguments
  6.  * into 鈥減ositional arguments鈥 and 鈥渙ptional arguments鈥
  7.  * when displaying help messages. When there is a better
  8.  * conceptual grouping of arguments than this default one,
  9.  * appropriate groups can be created using the addArgumentGroup() method
  10.  *
  11.  * This class inherited from [[ArgumentContainer]]
  12.  **/
  13. 'use strict';
  14.  
  15. var util = require('util');
  16.  
  17. var ArgumentGroup = require('./group');
  18.  
  19. /**
  20.  * new MutuallyExclusiveGroup(container, options)
  21.  * - container (object): main container
  22.  * - options (object): options.required -> true/false
  23.  *
  24.  * `required` could be an argument itself, but making it a property of
  25.  * the options argument is more consistent with the JS adaptation of the Python)
  26.  **/
  27. var MutuallyExclusiveGroup = module.exports = function MutuallyExclusiveGroup(container, options) {
  28.   var required;
  29.   options = options || {};
  30.   required = options.required || false;
  31.   ArgumentGroup.call(this, container);
  32.   this.required = required;
  33.  
  34. };
  35. util.inherits(MutuallyExclusiveGroup, ArgumentGroup);
  36.  
  37.  
  38. MutuallyExclusiveGroup.prototype._addAction = function (action) {
  39.   var msg;
  40.   if (action.required) {
  41.     msg = 'mutually exclusive arguments must be optional';
  42.     throw new Error(msg);
  43.   }
  44.   action = this._container._addAction(action);
  45.   this._groupActions.push(action);
  46.   return action;
  47. };
  48.  
  49.  
  50. MutuallyExclusiveGroup.prototype._removeAction = function (action) {
  51.   this._container._removeAction(action);
  52.   this._groupActions.remove(action);
  53. };
  54.  
  55.  
downloadexclusive.js Source code - Download reactide Source code
Related Source Codes/Software:
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
postal - 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top