BVB Source Codes

reactide Show group.js Source code

Return Download reactide: download group.js Source code - Download reactide Source code - Type:.js
  1. /** internal
  2.  * class ArgumentGroup
  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 ActionContainer = require('../action_container');
  18.  
  19.  
  20. /**
  21.  * new ArgumentGroup(container, options)
  22.  * - container (object): main container
  23.  * - options (object): hash of group options
  24.  *
  25.  * #### options
  26.  * - **prefixChars**  group name prefix
  27.  * - **argumentDefault**  default argument value
  28.  * - **title**  group title
  29.  * - **description** group description
  30.  *
  31.  **/
  32. var ArgumentGroup = module.exports = function ArgumentGroup(container, options) {
  33.  
  34.   options = options || {};
  35.  
  36.   // add any missing keyword arguments by checking the container
  37.   options.conflictHandler = (options.conflictHandler || container.conflictHandler);
  38.   options.prefixChars = (options.prefixChars || container.prefixChars);
  39.   options.argumentDefault = (options.argumentDefault || container.argumentDefault);
  40.  
  41.   ActionContainer.call(this, options);
  42.  
  43.   // group attributes
  44.   this.title = options.title;
  45.   this._groupActions = [];
  46.  
  47.   // share most attributes with the container
  48.   this._container = container;
  49.   this._registries = container._registries;
  50.   this._actions = container._actions;
  51.   this._optionStringActions = container._optionStringActions;
  52.   this._defaults = container._defaults;
  53.   this._hasNegativeNumberOptionals = container._hasNegativeNumberOptionals;
  54.   this._mutuallyExclusiveGroups = container._mutuallyExclusiveGroups;
  55. };
  56. util.inherits(ArgumentGroup, ActionContainer);
  57.  
  58.  
  59. ArgumentGroup.prototype._addAction = function (action) {
  60.   // Parent add action
  61.   action = ActionContainer.prototype._addAction.call(this, action);
  62.   this._groupActions.push(action);
  63.   return action;
  64. };
  65.  
  66.  
  67. ArgumentGroup.prototype._removeAction = function (action) {
  68.   // Parent remove action
  69.   ActionContainer.prototype._removeAction.call(this, action);
  70.   var actionIndex = this._groupActions.indexOf(action);
  71.   if (actionIndex >= 0) {
  72.     this._groupActions.splice(actionIndex, 1);
  73.   }
  74. };
  75.  
  76.  
downloadgroup.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