Add commands recursively.
@param commands Object[] An array of command descriptor {name: string, description: string, :action: function}.
@return Object Return Command.IO API.
960820
function addCommands(commands){
	for(var i in commands){
		var commandObj = commands[i];
		addCommand(commandObj);
	}

	return module.exports;
}
800195
public void addCommand(Command command) {
        if(command == null)
            throw new IllegalArgumentException();

        if(_frozen)
            throw new IllegalStateException();

        Command[] results = new Command[_commands.length + 1];
        System.arraycopy(_commands, 0, results, 0, _commands.length);
        results[_commands.length] = command;
        _commands = results;
    }
336598
public void addCommands(Iterable<Command> commands) {
		Assert.notNull(commands, "Commands must not be null");
		for (Command command : commands) {
			addCommand(command);
		}
	}
260789
function Command(commandSpec) {
  Object.keys(commandSpec).forEach(function(key) {
    this[key] = commandSpec[key];
  }, this);

  if (!this.name) {
    throw new Error('All registered commands must have a name');
  }

  if (this.params == null) {
    this.params = [];
  }
  if (!Array.isArray(this.params)) {
    throw new Error('command.params must be an array in ' + this.name);
  }

  this.hasNamedParameters = false;
  this.description = 'description' in this ? this.description : undefined;
  this.description = lookup(this.description, 'canonDescNone');
  this.manual = 'manual' in this ? this.manual : undefined;
  this.manual = lookup(this.manual);

  // At this point this.params has nested param groups. We want to flatten it
  // out and replace the param object literals with Parameter objects
  var paramSpecs = this.params;
  this.params = [];

  // Track if the user is trying to mix default params and param groups.
  // All the non-grouped parameters must come before all the param groups
  // because non-grouped parameters can be assigned positionally, so their
  // index is important. We don't want 'holes' in the order caused by
  // parameter groups.
  var usingGroups = false;

  if (this.returnType == null) {
    this.returnType = 'string';
  }

  // In theory this could easily be made recursive, so param groups could
  // contain nested param groups. Current thinking is that the added
  // complexity for the UI probably isn't worth it, so this implementation
  // prevents nesting.
  paramSpecs.forEach(function(spec) {
    if (!spec.group) {
      if (usingGroups) {
        throw new Error('Parameters can\'t come after param groups.' +
                        ' Ignoring ' + this.name + '/' + spec.name);
      }
      else {
        var param = new Parameter(spec, this, null);
        this.params.push(param);

        if (!param.isPositionalAllowed) {
          this.hasNamedParameters = true;
        }
      }
    }
    else {
      spec.params.forEach(function(ispec) {
        var param = new Parameter(ispec, this, spec.group);
        this.params.push(param);

        if (!param.isPositionalAllowed) {
          this.hasNamedParameters = true;
        }
      }, this);

      usingGroups = true;
    }
  }, this);
}
1284071
public static function commands(){
       $results = [];
       foreach(static::$commands as $name => $cmd){
          $results[] = [
            'name'        => $name,
            'params'      => preg_replace('/:(\w+)/','[$1]',implode(' ',$cmd[0])),
            'description' => $cmd[2],
          ];
       }
       return $results;
    }
493521
def add_command(self, command):
        
        self._commands.append(command)
        self._build_command_chain(command)
1305327
private List<String> initCommand(){
        List<String> command = new ArrayList<String>();
        command.add(cmd);
        command.add("install");
        if (acceptLicense) {
            command.add("--acceptLicense");
        } else {
            command.add("--viewLicenseAgreement");
        }
        if (to != null) {
            command.add("--to=" + to);
        }
        if (from != null) {
            command.add("--from=" + from);
        }
        
        return command;
    }
239539
function Command(types, commandSpec) {
  Object.keys(commandSpec).forEach(function(key) {
    this[key] = commandSpec[key];
  }, this);

  if (!this.name) {
    throw new Error('All registered commands must have a name');
  }

  if (this.params == null) {
    this.params = [];
  }
  if (!Array.isArray(this.params)) {
    throw new Error('command.params must be an array in ' + this.name);
  }

  this.hasNamedParameters = false;
  this.description = 'description' in this ? this.description : undefined;
  this.description = lookup(this.description, 'canonDescNone');
  this.manual = 'manual' in this ? this.manual : undefined;
  this.manual = lookup(this.manual);

  // At this point this.params has nested param groups. We want to flatten it
  // out and replace the param object literals with Parameter objects
  var paramSpecs = this.params;
  this.params = [];
  this.paramGroups = {};
  this._shortParams = {};

  var addParam = function(param) {
    var groupName = param.groupName || l10n.lookup('canonDefaultGroupName');
    this.params.push(param);
    if (!this.paramGroups.hasOwnProperty(groupName)) {
      this.paramGroups[groupName] = [];
    }
    this.paramGroups[groupName].push(param);
  }.bind(this);

  // Track if the user is trying to mix default params and param groups.
  // All the non-grouped parameters must come before all the param groups
  // because non-grouped parameters can be assigned positionally, so their
  // index is important. We don't want 'holes' in the order caused by
  // parameter groups.
  var usingGroups = false;

  // In theory this could easily be made recursive, so param groups could
  // contain nested param groups. Current thinking is that the added
  // complexity for the UI probably isn't worth it, so this implementation
  // prevents nesting.
  paramSpecs.forEach(function(spec) {
    if (!spec.group) {
      var param = new Parameter(types, spec, this, null);
      addParam(param);

      if (!param.isPositionalAllowed) {
        this.hasNamedParameters = true;
      }

      if (usingGroups && param.groupName == null) {
        throw new Error('Parameters can\'t come after param groups.' +
                        ' Ignoring ' + this.name + '/' + spec.name);
      }

      if (param.groupName != null) {
        usingGroups = true;
      }
    }
    else {
      spec.params.forEach(function(ispec) {
        var param = new Parameter(types, ispec, this, spec.group);
        addParam(param);

        if (!param.isPositionalAllowed) {
          this.hasNamedParameters = true;
        }
      }, this);

      usingGroups = true;
    }
  }, this);

  this.params.forEach(function(param) {
    if (param.short != null) {
      if (this._shortParams[param.short] != null) {
        throw new Error('Multiple params using short name ' + param.short);
      }
      this._shortParams[param.short] = param;
    }
  }, this);
}
348218
public void defer(ICommandData[] commands) {
        deferredCommands.addAll(Arrays.asList(commands));
        for (ICommandData command : commands) {
            deferInternal(command);
        }
    }
666681
public function addCommand($command, $config = array())
    {
        if (!($command instanceof KControllerToolbarCommandInterface)) {
            $command = $this->getCommand($command, $config);
        }

        //Set the command parent
        $command->setParent($this);

        $this->_commands[$command->getName()] = $command;
        return $command;
    }
1034290
public static ArrayList<String> runProcess(String... commands)
      throws InterruptedException, IOException {
    final java.lang.ProcessBuilder processBuilder = new java.lang.ProcessBuilder(commands);
    final ArrayList<String> output = new ArrayList<>();
    final Process process = processBuilder.start();
    process.waitFor();
    final InputStream inputStream = process.getInputStream();
    try {
      final java.io.BufferedReader reader = new java.io.BufferedReader(
          new InputStreamReader(inputStream, StandardCharsets.UTF_8));
      String line;
      while ((line = reader.readLine()) != null) {
        output.add(line);
      }
    } finally {
      inputStream.close();
    }
    return output;
  }
131492
public function discoverCommands()
    {
        $commands = (new PhpClassDiscovery())
            ->addSearchLocation(APP_ROOT . '/src/Command')
            ->matchExtend('Symfony\Component\Console\Command\Command')
            ->discover();

        foreach ($commands as $classname) {
            $this->add(new $classname());
        }

        return $this;
    }
144169
function (commands) {
    this.activeCommands = [];

    this.setCommands(commands);

    this.currentTime = 0;

    this.keyboard = new Keyboard();
    this.gamepads = Gamepads.isSupported ? Gamepads : null;
}
1355952
public CommandLineBuilder append(final String[] segments) {
        if (segments != null && segments.length > 0) {
            final String[] command = new String[commandLine.length + segments.length];
            System.arraycopy(commandLine, 0, command, 0, commandLine.length);
            System.arraycopy(segments, 0, command, commandLine.length, segments.length);
            commandLine = command;
        }
        return this;
    }
925717
public java.util.List<Command> getCommands() {
        if (commands == null) {
            commands = new com.amazonaws.internal.SdkInternalList<Command>();
        }
        return commands;
    }
605735
function Command(name, parent) {
  if (!(this instanceof Command)) {
    return new Command();
  }
  this.commands = [];
  this.options = [];
  this._args = [];
  this._aliases = [];
  this._name = name;
  this._relay = false;
  this._hidden = false;
  this._parent = parent;
  this._mode = false;
  this._catch = false;
  this._help = undefined;
  this._init = undefined;
  this._after = undefined;
  this._allowUnknownOptions = false;
}
1096475
def linkify_command_list_with_commands(self, commands, prop):
        
        for i in self:
            if not hasattr(i, prop):
                continue

            commands_list = strip_and_uniq(getattr(i, prop, ''))
            cmds_list = []
            for command in commands_list:
                if not command:
                    continue

                cmds_list.append(self.create_commandcall(i, commands, command))
            setattr(i, prop, cmds_list)