Returns a command with the VCS's binary.

@param string|null     $command
@param string|string[] $arguments
@param string|string[] $flags
@param array           $environmentVariables

@return string
541520
public function getCommand($command = null, $arguments = [], $flags = [], $environmentVariables = [])
    {
        // Format arguments
        $arguments = $this->buildArguments($arguments);
        $options = $this->buildOptions($flags);
        $environmentVariables = $this->buildEnvironmentVariables($environmentVariables);

        // Build command
        $binary = $this->getBinary();
        $components = [$command, $arguments, $options];
        foreach ($components as $component) {
            if ($component) {
                $binary .= ' '.$component;
            }
        }

        // If the binary has a parent, wrap the call with it
        $parent = $this->parent instanceof self ? $this->parent->getBinary() : $this->parent;
        $command = $environmentVariables.$parent.' '.$binary;

        return trim($command);
    }
962786
protected function detectConsoleEnvironment($environments, array $args)
    {
        // First we will check if an environment argument was passed via console arguments
        // and if it was that automatically overrides as the environment. Otherwise, we
        // will check the environment as a "web" request like a typical HTTP request.
        if (!is_null($value = $this->getEnvironmentArgument($args))) {
            return head(array_slice(explode('=', $value), 1));
        }
    }
1082777
public static CommandResult execCommand(String command, boolean isRoot, boolean isNeedResultMsg) {
        return execCommand(new String[]{command}, isRoot, isNeedResultMsg);
    }
12731
public function detect($environments, $consoleArgs = null)
    {
        if ($consoleArgs && $env = $this->detectConsoleEnvironment($environments, $consoleArgs)) {
            return $env;
        } elseif ($env = $this->detectClosureEnvironment($environments)) {
            return $env;
        } elseif ($env = $this->detectVariableEnvironment($environments)) {
            return $env;
        }
        return $this->detectWebEnvironment($environments);
    }
184355
public function command($command, array $parameters = [])
    {
        if (class_exists($command)) {
            $command = (new $command)->getName();
        }

        return $this->exec(
            Application::formatCommandString($command), $parameters
        );
    }
1168667
public function getJob($command, array $args = [])
    {
        if (null !== $job = $this->findJob($command, $args)) {
            return $job;
        }

        throw new \RuntimeException(sprintf('Found no job for command "%s" with args "%s".', $command, json_encode($args)));
    }
372063
def environment_list_command(environment_command)
      environment_command.desc 'List the remote environments in the project'
      environment_command.command :list do |environment_list_command|
        environment_list_command.action do |global_options,options,args|
          environments = Bebox::Environment.list(project_root)
          title _('cli.environment.list.current_envs')
          environments.map{|environment| msg(environment)}
          warn(_('cli.environment.list.no_envs')) if environments.empty?
        end
      end
    end
1064351
public static function Option($optionName = null, $envVariableName = null, $default = false) {
		if (empty($optionName) && empty($envVariableName)) {
			return $default;
		}

		if ($envVariableName == null) {
			$envVariableName = str_replace('-','_', strtoupper($optionName));
		}

		if (is_array($envVariableName)) {
			foreach($envVariableName as $envVariable) {
				$envval = getenv($envVariable);
				if ($envval) {
					return $envval;
				}
			}
		} else {
			$envval = getenv($envVariableName);
			if ($envval) {
				return $envval;
			}
		}

		if (empty($optionName)) {
			return $default;
		}

		return get_option($optionName, $default);
	}
1157284
private function convertEnvValue($value, $environmentVariable)
    {
        $value = trim(trim(trim($value, '\''), '"'));

        if ($this->isBoolean($value)) {
            $value = $this->convertBoolean($value);
        } elseif ($this->isInteger($value)) {
            $value = $this->convertInteger($value);
        } elseif ($this->isJson($value)) {
            $value = $this->convertJson($value, $environmentVariable);
        }

        return $value;
    }
154167
public static function parse($dotenv, $data = [], $flags = self::FLAG_STRICT)
    {
        if (!is_array($dotenv)) {
            $dotenv = explode("\n", $dotenv);
        }
        $result = (!empty($data)) ? $data : [];

        // nothing to do with empty dotenv
        if (empty($dotenv)) {
            return $result;
        }

        // FLAG_REPLACE_DUPLICATES and FLAG_STRICT are mutually exclusive
        if (($flags & static::FLAG_REPLACE_DUPLICATES) &&  ($flags & static::FLAG_STRICT)) {
            throw new InvalidArgumentException("Can't use FLAG_REPLACE_DUPLICATES and FLAG_STRICT together");
        }

        foreach ($dotenv as $line) {
            $line = trim($line);

            // Disregard comments
            if (strpos($line, '#') === 0) {
                continue;
            }

            // Only use nont-empty lines that look like setters
            if (!preg_match('#^\s*(.+?)=(.*)?$#', $line, $matches)) {
                continue;
            }

            $name = static::normalizeName($matches[1]);

            $value = static::normalizeValue(trim($matches[2]));
            $value = static::resolveNested($value, $result);

            if ($value === "" && ($flags & static::FLAG_SKIP_EMPTY)) {
                continue;
            }

            if (!isset($result[$name]) || ($flags & static::FLAG_REPLACE_DUPLICATES)) {
                $result[$name] = $value;
                continue;
            }

            if ($flags & static::FLAG_STRICT) {
                throw new RuntimeException("Duplicate value found for variable '$name'");
            }
        }

        return $result;
    }
773461
public static void main(String[] args) {
    if (args.length < 1) {
      System.err.printf("$ java ... %s environmentVariable [environmentVariable]*%n",
        GetEnvironmentVariableValue.class.getName());
      System.exit(1);
    }

    Arrays.stream(args).forEach(environmentVariable ->
      System.out.println(newEnvironmentVariableValue(environmentVariable)));
  }
93536
protected function _call ($command, array $arguments = array(), array $values = null)
    {
        try {
            $this->_connected || $this->connect();
        } catch (\Exception $e) {
            throw $e;
        }

        extract($arguments);

        if (isset($collection_name)) {
            $c = $this->_db->selectCollection($collection_name);
        }

        switch ($command) {
            case 'ensure_index':
                $r = $c->ensureIndex($keys, $options);
                break;
            case 'create_collection':
                $r = $this->_db->createCollection($name, $capped, $size, $max);
                break;
            case 'drop_collection':
                $r = $this->_db->dropCollection($name);
                break;
            case 'command':
                $r = $this->_db->command($values);
                break;
            case 'execute':
                $r = $this->_db->execute($code, $args);
                break;
            case 'batch_insert':
                $r = $c->batchInsert($values);
                break;
            case 'count':
                $r = $c->count($query);
                break;
            case 'find_one':
                $r = $c->findOne($query, $fields);
                break;
            case 'find':
                $r = $c->find($query, $fields);
                break;
            case 'group':
                $r = $c->group($keys, $initial, $reduce, $condition);
                break;
            case 'update':
                $r = $c->update($criteria, $values, $options);
                break;
            case 'insert':
                $r = $c->insert($values, $options);

                return $values;
                break;
            case 'remove':
                $r = $c->remove($criteria, $options);
                break;
            case 'save':
                $r = $c->save($values, $options);
                break;
            case 'get_file':
                $r = $this->gridFS()->findOne($criteria);
                break;
            case 'get_files':
                $r = $this->gridFS()->find($query, $fields);
                break;
            case 'set_file_bytes':
                $r = $this->gridFS()->storeBytes($bytes, $extra, $options);
                break;
            case 'set_file':
                $r = $this->gridFS()->storeFile($filename, $extra, $options);
                break;
            case 'remove_file':
                $r = $this->gridFS()->remove($criteria, $options);
                break;
            case 'aggregate':
                $r = call_user_func_array(array($c, 'aggregate'), $ops);
                break;
        }

        return $r;
    }
190629
def do(cmdline, runas=None, env=None):
    '''
    
    '''
    if not cmdline:
        # This is a positional argument so this should never happen, but this
        # will handle cases where someone explicitly passes a false value for
        # cmdline.
        raise SaltInvocationError('Command must be specified')

    path = _rbenv_path(runas)
    if not env:
        env = {}

    # NOTE: Env vars (and their values) need to be str type on both Python 2
    # and 3. The code below first normalizes all path components to unicode to
    # stitch them together, and then converts the result back to a str type.
    env[str('PATH')] = salt.utils.stringutils.to_str(   # future lint: disable=blacklisted-function
        os.pathsep.join((
            salt.utils.path.join(path, 'shims'),
            salt.utils.stringutils.to_unicode(os.environ['PATH'])
        ))
    )

    try:
        cmdline = salt.utils.args.shlex_split(cmdline)
    except AttributeError:
        cmdauth = salt.utils.args.shlex_split(six.text_type(cmdline))

    result = __salt__['cmd.run_all'](
        cmdline,
        runas=runas,
        env=env,
        python_shell=False
    )

    if result['retcode'] == 0:
        rehash(runas=runas)
        return result['stdout']
    else:
        return False
21073
public static function environmentVariable( $variableName, $quiet = false )
    {
        if ( getenv($variableName) === false )
        {
            if ( !$quiet )
            {
                eZDebug::writeError( "Environment variable '$variableName' does not exist", __METHOD__ );
            }
            return null;
        }
        return getenv($variableName);
    }
92489
protected function exec($command, array $arguments = array())
    {
        $command = $this->bin . ' ' . $command;

        $commandline = $this->cli->prepare($command, $arguments);

        if ($this->cli->execute($commandline) <> 0) {
            throw new ProcessFailedException($this->cli->getProcess());
        } elseif ($message = $this->cli->getErrorOutput()) {
            throw new \RuntimeException($message);
        }

        return $this->cli->getOutput();
    }
342692
public function execute($binPath = null, $args = null, $env = null)
    {
        if ($binPath !== null) {
            $this->binPath = $binPath;
        }

        if ($env !== null) {
            $this->env = $env;
        }

        if ($args !== null) {
            $this->args = $args;
        }
        $this->cmd = $this->binPath . static::buildArgs($this->args) . ($this->outputErrors ? ' 2>&1' : '');

        if (isset($this->setUser) || isset($this->setGroup)) {
            if (isset($this->setUser) && isset($this->setGroup) && ($this->setUser !== $this->setGroup)) {
                $this->cmd = 'sudo -g ' . escapeshellarg($this->setGroup) . '  -u ' . escapeshellarg($this->setUser) . ' ' . $this->cmd;
            } else {
                $this->cmd = 'su ' . escapeshellarg($this->setGroup) . ' -c ' . escapeshellarg($this->cmd);
            }
        }

        if ($this->chroot !== '/') {
            $this->cmd = 'chroot ' . escapeshellarg($this->chroot) . ' ' . $this->cmd;
        }

        if ($this->nice !== null) {
            $this->cmd = 'nice -n ' . ((int)$this->nice) . ' ' . $this->cmd;
        }

        $pipesDescr = [
            0 => ['pipe', 'r'], // stdin is a pipe that the child will read from
            1 => ['pipe', 'w'] // stdout is a pipe that the child will write to
        ];

        if (($this->errlogfile !== null) && !$this->outputErrors) {
            $pipesDescr[2] = ['file', $this->errlogfile, 'a']; // @TODO: refactoring
        }

        $this->pd = proc_open($this->cmd, $pipesDescr, $this->pipes, $this->cwd, $this->env);
        if ($this->pd) {
            $this->setFd($this->pipes[1]);
        }

        return $this;
    }
930040
public static CommandResult execCommand(List<String> commands, boolean isRoot, boolean isNeedResultMsg) {
        return execCommand(commands == null ? null : commands.toArray(new String[]{}), isRoot, isNeedResultMsg);
    }