Runs behat command with provided parameters in interactive mode

@When /^I answer "([^"]+)" when running "behat(?: ((?:\"|[^"])*))?"$/

@param string $answerString
@param string $argumentsString
18308
public function iRunBehatInteractively($answerString, $argumentsString)
    {
        $env = $this->process->getEnv();
        $env['SHELL_INTERACTIVE'] = true;

        $this->process->setEnv($env);
        $this->process->setInput($answerString);

        $this->options = '--format-settings=\'{"timer": false}\'';
        $this->iRunBehat($argumentsString);
    }
872833
public int run(String... args) {

    CliParser parser = getParserBuilder().build(this);
    try {
      CliModeObject mode = parser.parseParameters(args);
      if (this.help) {
        assert (mode.getId().equals(CliMode.ID_HELP));
        printHelp(parser);
        return 0;
      }
      validate(mode);
      return run(mode);
    } catch (Exception e) {
      return handleError(e, parser);
    } finally {
      getStandardOutput().flush();
      getStandardError().flush();
    }
  }
335587
public function execute($command, $arguments = array())
    {
        $options = $this->getOptions();
        $consoleDir = $this->getConsoleDir();

        if (null === $consoleDir) {
            return;
        }

        $argumentString = '';

        foreach ($arguments as $argument) {
            $argumentString .= escapeshellarg($argument) . ' ';
        }

        $this->executeCommand($consoleDir, $command . ' ' . $argumentString);
    }
701960
public function iRunPhpdoc($argumentsString = '')
    {
        $argumentsString .= ' --template=xml';
        $argumentsString = strtr($argumentsString, array('\'' => '"'));

        // the app is always run in debug mode to catch debug information and collect the AST that is written to disk
        $this->process->setCommandLine(
            sprintf('%s %s %s', 'php', escapeshellarg($this->binaryPath), $argumentsString . ' -vvv')
        );
        $this->process->start();
        $this->process->wait();
    }
1411
public function runQuery($queryString){

		$this->affectedRows = false;
		$result = $this->resource->query($queryString, $this->unbuffered ? MYSQLI_USE_RESULT : MYSQLI_STORE_RESULT);

		$error = preg_replace('~You have an error in your SQL syntax; check the manual that corresponds to your \w+ server version for the right syntax to use~i', 'Syntax error', $this->resource->error);
		if($error && $result === false)
			throw new DriverException($error, $this->resource->errno, $queryString);

		$this->affectedRows = $this->resource->affected_rows;
		return $result;
	}
1333485
public function pass($asString = false)
    {
        if (!$this->_checked) {
            $this->check();
        }

        if (!$asString) {
            return $this->_pass;
        }

        $items = [];
        foreach ($this->_pass as $rule) {
            $items[] = "{$rule}";
        }

        return implode(', ', $items);
    }
2717
public function parseString($string)
    {
        if (!mb_strlen($string)) {
            throw new \InvalidArgumentException('Option string must not be empty');
        }
        $options = array();
        $eol = mb_strlen($string) - 1;
        $nextCanBeColon = false;
        for ($i = 0; $i <= $eol; ++$i) {
            $ch = $string[$i];
            if (!preg_match('/^[A-Za-z0-9]$/', $ch)) {
                $colon = $nextCanBeColon ? " or ':'" : '';
                throw new \InvalidArgumentException("Option string is not well formed: "
                    ."expected a letter$colon, found '$ch' at position ".($i + 1));
            }
            if ($i == $eol || $string[$i + 1] != ':') {
                $options[] = new Option($ch, null, Getopt::NO_ARGUMENT);
                $nextCanBeColon = true;
            } elseif ($i < $eol - 1 && $string[$i + 2] == ':') {
                $options[] = new Option($ch, null, Getopt::OPTIONAL_ARGUMENT);
                $i += 2;
                $nextCanBeColon = false;
            } else {
                $options[] = new Option($ch, null, Getopt::REQUIRED_ARGUMENT);
                ++$i;
                $nextCanBeColon = true;
            }
        }
        return $options;
    }
1218476
function run2(stringOrFunction, number, boolean, anyDataType, anObject) {
        /*
        * If you don't want args-checker to throw errors, just simply pass a true value
        * on the third parameter. Or you can pass a callback function to get the results/errors
        * thrown by args-checker.
        * */
        args.expect(arguments, ['string|function', 'number', 'boolean', '*', 'object'], function(results) {
            console.log(results);
        });

        // do something here...
    }
166424
public function setString($parameterIndex, $string)
    {
        if (!is_string($string)) {
            throw new CmisInvalidArgumentException('Parameter string must be of type string!');
        }

        $this->setParameter($parameterIndex, $this->escape($string));
    }
1271840
public function evaluateQuestion(array $question, PhpStringParser $parser, GeneratorDataObject $generator)
    {
        $complex = DirectoryQuestionFactory::getInstance($this->context);

        return $complex->ask($generator, $question);
    }
1059641
public function callbackCallCommand(ManialinkInterface $manialink, $login, $params, $arguments)
    {
        $this->chatCommandDataProvider->onPlayerChat(-1, $login, '/'.$arguments['command'], true);
    }
273789
function extract_action_and_args($string) {

    if ('' === $string) {
      return array('index', array(), NULL);
    }

    // find optional file extension
    $format = NULL;
    if (preg_match('/^(.*[^\/.])\.(\w+)$/', $string, $matches)) {
      list($_, $string, $format) = $matches;
    }

    // TODO this should possibly remove empty tokens
    $args = explode('/', $string);
    $action = array_shift($args);
    return array($action, $args, $format);
  }
164990
public function match($string)
    {
        if (!is_string($string)) {
            throw new InvalidArgumentException('
                Invalid argument. Expected a string, received ' . gettype($string)
            );
        }

        return (bool) preg_match(
            '/' . $this->getRule() . '/ms', strtolower($string)
        );
    }
152866
public void run(String[] args) {
    // Add and parse options.
    OptionParser parser = new OptionParser();
    initializeCommonOptions(parser);
    initializeOptions(parser);

    String errorMessage = null;
    try {
      parsedOptions = parser.parse(args);
    } catch (OptionException e) {
      errorMessage = e.getMessage();
    }

    boolean printHelp = false;
    if (errorMessage != null) {
      // If an error occurs, the options don't parse.
      // Therefore, we must manually check if the help option was
      // given.
      for (int i = 0; i < args.length; i++) {
        if (args[i].equals("--help")) {
          printHelp = true;
        }
      }
    }

    if (errorMessage != null && !printHelp) {
      System.err.println(errorMessage);
      System.err.println("Try --help for more information about options.");
      System.exit(1);
    }

    if (printHelp || parsedOptions.has(helpOpt)) {
      // If a help option is given, print help then quit.
      try {
        parser.printHelpOn(System.err);
      } catch (IOException ioException) {
        throw new RuntimeException(ioException);
      }
      System.exit(0);
    }

    // Log any passed-in options.
    if (!parsedOptions.has(noPrintOptions)) {
      System.out.println("Command-line options:");
      for (OptionSpec<?> optionSpec : parsedOptions.specs()) {
        if (parsedOptions.hasArgument(optionSpec)) {
          System.out.println("--" + Iterables.getFirst(optionSpec.options(), "") + " "
              + Joiner.on(" ").join(parsedOptions.valuesOf(optionSpec)));
        } else {
          System.out.println("--" + Iterables.getFirst(optionSpec.options(), ""));
        }
      }
      System.out.println("");
    }

    // Run the program.
    long startTime = System.currentTimeMillis();
    processOptions(parsedOptions);
    run(parsedOptions);
    long endTime = System.currentTimeMillis();

    if (!parsedOptions.has(noPrintOptions)) {
      System.out.println("Total time elapsed: " + TimeUtils.durationToString(endTime - startTime));
    }

    System.exit(0);
  }
29376
static void parseArgs(String[] args) {
    int i = 0;
    while (true) {
      if (i >= args.length) {
        break;
      }

      String s = args[i];
      if (s.equals("-h") ||
              s.equals("help") ||
              s.equals("-help") ||
              s.equals("--help")) {
        usage();
      }
      else if (s.equals("-zk")) {
        i++; if (i >= args.length) { usage(); }
        g_zk = args[i];
      }
      else if (s.equals("-zkroot")) {
        i++; if (i >= args.length) { usage(); }
        g_zkroot = args[i];
      }
      else if (s.equals("-n") ||
              s.equals("-nodes")) {
        i++; if (i >= args.length) { usage(); }
        g_numNodes = Integer.parseInt(args[i]);
      }
      else if (s.equals("-timeout")) {
        i++; if (i >= args.length) { usage(); }
        g_cloudFormationTimeoutSeconds = Integer.parseInt(args[i]);
      }
      else if (s.equals("-start")) {
        g_start = true;
      }
      else if (s.equals("-wait")) {
        g_wait = true;
      }
      else {
        error("Unrecognized option " + s);
      }

      i++;
    }

    // Check for mandatory arguments.
    if (g_start) {
      if (g_numNodes < 1) {
        error("Number of H2O nodes must be greater than 0 (must specify -n)");
      }
    }

    if (g_wait) {
      if (g_numNodes != -1) {
        error("-nodes option may not be combined with -wait option");
      }
    }

    if (!g_start && !g_wait) {
      error("-start or -wait must be specified");
    }
  }
914509
public function rawRun($commandString)
    {
        $this->validateCommand($commandString);

        /** @var $process \Symfony\Component\Process\Process */
        $process = new $this->processClass($commandString);
        $process->setTimeout($this->timeout);
        $process->run();

        if (!$process->isSuccessful()) {
            throw new RuntimeException($process->getErrorOutput());
        }

        return $process->getOutput();
    }
1287191
public void setArgs(String argString)
  {
    try {
      if (argString != null) {
        String []args = Pattern.compile("[\\s,]+").split(argString);

        _args = new ArrayList<String>();

        for (int i = 0; i < args.length; i++) {
          if (! args[i].equals(""))
            _args.add(args[i]);
        }
      }
    } catch (Exception e) {
      log.log(Level.WARNING, e.toString(), e);
    }
  }