Prepare the command string
425584
def _cmd_str(self):
        '''
        
        '''
        sudo = 'sudo' if self.target['sudo'] else ''
        sudo_user = self.target['sudo_user']
        if '_caller_cachedir' in self.opts:
            cachedir = self.opts['_caller_cachedir']
        else:
            cachedir = self.opts['cachedir']
        thin_code_digest, thin_sum = salt.utils.thin.thin_sum(cachedir, 'sha1')
        debug = ''
        if not self.opts.get('log_level'):
            self.opts['log_level'] = 'info'
        if salt.log.LOG_LEVELS['debug'] >= salt.log.LOG_LEVELS[self.opts.get('log_level', 'info')]:
            debug = '1'
        arg_str = '''
OPTIONS.config = \
"""
{config}
"""
OPTIONS.delimiter = '{delimeter}'
OPTIONS.saltdir = '{saltdir}'
OPTIONS.checksum = '{checksum}'
OPTIONS.hashfunc = '{hashfunc}'
OPTIONS.version = '{version}'
OPTIONS.ext_mods = '{ext_mods}'
OPTIONS.wipe = {wipe}
OPTIONS.tty = {tty}
OPTIONS.cmd_umask = {cmd_umask}
OPTIONS.code_checksum = {code_checksum}
ARGS = {arguments}\n'''.format(config=self.minion_config,
                               delimeter=RSTR,
                               saltdir=self.thin_dir,
                               checksum=thin_sum,
                               hashfunc='sha1',
                               version=salt.version.__version__,
                               ext_mods=self.mods.get('version', ''),
                               wipe=self.wipe,
                               tty=self.tty,
                               cmd_umask=self.cmd_umask,
                               code_checksum=thin_code_digest,
                               arguments=self.argv)
        py_code = SSH_PY_SHIM.replace('#%%OPTS', arg_str)
        if six.PY2:
            py_code_enc = py_code.encode('base64')
        else:
            py_code_enc = base64.encodebytes(py_code.encode('utf-8')).decode('utf-8')
        if not self.winrm:
            cmd = SSH_SH_SHIM.format(
                DEBUG=debug,
                SUDO=sudo,
                SUDO_USER=sudo_user,
                SSH_PY_CODE=py_code_enc,
                HOST_PY_MAJOR=sys.version_info[0],
            )
        else:
            cmd = saltwinshell.gen_shim(py_code_enc)

        return cmd
435192
def _PreParse(self, key, value):
    """"""
    if key == 'Command':
      return re.sub(r'(\[\[.+?\]\])', self._Completion, value)
    else:
      return value
1256289
def _cmd_str(self, cmd, ssh='ssh'):
        '''
        
        '''

        # TODO: if tty, then our SSH_SHIM cannot be supplied from STDIN Will
        # need to deliver the SHIM to the remote host and execute it there

        command = [ssh]
        if ssh != 'scp':
            command.append(self.host)
        if self.tty and ssh == 'ssh':
            command.append('-t -t')
        if self.passwd or self.priv:
            command.append(self.priv and self._key_opts() or self._passwd_opts())
        if ssh != 'scp' and self.remote_port_forwards:
            command.append(' '.join(['-R {0}'.format(item)
                                      for item in self.remote_port_forwards.split(',')]))
        if self.ssh_options:
            command.append(self._ssh_opts())

        command.append(cmd)

        return ' '.join(command)
1237159
function prepairRcpt(cmds) {
	var idx
	var rcpts

	for (var i = 0, l = cmds.length; i < l; i++) {
		if (cmds[i].indexOf(CMD_RCPT_TO) > -1) {
			idx = i
			rcpts = cmds[i]
			break
		}
	}

	if (rcpts) {
		rcpts = rcpts.substr(CMD_RCPT_TO.length).split(/;\s*/).map(function (rcpt) {
			var address = /.*\<(.+@.+)\>.*/.exec(rcpt)
			address = address && address[1] || rcpt
			return CMD_RCPT_TO + address
		})
		cmds.splice.apply(cmds, [idx, 1].concat(rcpts))
	}
}
198361
def cli(ctx, pattern, arguments, safe):
    """"""

    matches = utils.grep_commands(pattern)
    if matches:
        selected = utils.select_command(matches)
        if selected >= 0:
            cmd, desc = matches[selected]
            pcmd = utils.create_pcmd(cmd)
            raw_params, params, defaults = utils.get_params_in_pcmd(pcmd)

            arguments = list(arguments)
            kargs = {}
            for r, p, d in zip(raw_params, params, defaults):
                if arguments:
                    val = arguments.pop(0)
                    click.echo("{}: {}".format(p, val))
                    kargs[r] = val
                elif safe:
                    if d:
                        kargs[r] = d
                else:
                    p_default = d if d else None
                    val = click.prompt("Enter value for '{}'".format(p), default=p_default)
                    kargs[r] = val
            click.echo("\n")

            final_cmd = utils.substitute_pcmd(pcmd, kargs, safe)

            command = "$ {} :: {}".format(final_cmd, desc)
            if click.confirm("Execute\n\t{}\n\n?".format(command), default=True):
                os.system(final_cmd)
    elif matches == []:
        click.echo('No saved commands matches the pattern {}'.format(pattern))
    else:
        click.echo("No commands to run, Add one by 'keep new'. ")
761883
def decode(cls, command_str):
        

        name, _, arg = command_str.partition(" ")

        args = []

        if len(arg) > 0:
            if arg[0] != '{' or arg[-1] != '}':
                raise DataError("Invalid command, argument is not contained in { and }", arg=arg, cmd=name)

            arg = arg[1:-1]
            args = arg.split(",")

        proc = []

        for arg in args:
            if arg.startswith("hex:"):
                arg = unhexlify(arg[4:]).decode('utf-8')

            proc.append(arg)

        return Command(name, proc)
379939
def _execute_commands(self, commands, fails=False):
        """"""
        # Confirm that prepare_statements flag is on
        if self._prep_statements:
            prepared_commands = [prepare_sql(c) for c in tqdm(commands, total=len(commands),
                                                              desc='Prepping SQL Commands')]
            print('\tCommands prepared', len(prepared_commands))
        else:
            prepared_commands = commands

        desc = 'Executing SQL Commands' if not fails else 'Executing Failed SQL Commands'
        fail, success = [], 0
        for command in tqdm(prepared_commands, total=len(prepared_commands), desc=desc):
            # Attempt to execute command and skip command if error is raised
            try:
                self._MySQL.executemore(command)
                success += 1
            except:
                fail.append(command)
        self._MySQL._commit()
        return fail, success
452420
private static List<String> prepareBashCommand(List<String> cmd, Map<String, String> childEnv) {
    if (childEnv.isEmpty()) {
      return cmd;
    }

    List<String> newCmd = new ArrayList<>();
    newCmd.add("env");

    for (Map.Entry<String, String> e : childEnv.entrySet()) {
      newCmd.add(String.format("%s=%s", e.getKey(), e.getValue()));
    }
    newCmd.addAll(cmd);
    return newCmd;
  }
1245430
def process_command(command: CommandInput, matrix: VarMatrix) -> List[Command]:
    
    assert command is not None
    if isinstance(command, str):
        command_list = [Command(command, variables=variables) for variables in matrix]
    elif isinstance(command, list):
        command_list = [Command(command, variables=variables) for variables in matrix]
    else:
        if command.get("command") is not None:
            cmd = command.get("command")
        else:
            cmd = command.get("cmd")
        creates = str(command.get("creates", ""))
        requires = str(command.get("requires", ""))

        assert isinstance(cmd, (list, str))
        command_list = [
            Command(cmd, variables, creates, requires) for variables in matrix
        ]
    return uniqueify(command_list)
164436
function(command) {
        var patt = /("[^"]*")/,
            quotedStringPlaceholder = "__QUOTEDSTR__",
            escapedQuotePlaceholder = "__ESCAPED_QUOTE__",
            matches = [],
            match;

        command = command.replace(/\\\"/g, escapedQuotePlaceholder);

        while ((match = patt.exec(command))) {
            var matched = match[0];
            command =
                command.substr(0, match.index) + quotedStringPlaceholder + command.substr(match.index + matched.length);
            matches.push(matched.substring(1, matched.length - 1));
        }

        var parts = command.split(" ");
        parts = parts.map(function(part) {
            var item = part.trim();
            if (item === quotedStringPlaceholder) {
                item = matches.shift();
            }
            item = item.replace(new RegExp(escapedQuotePlaceholder, "g"), '"');
            return item;
        });

        return parts;
    }
223935
def format_as_command(str, io)
      if Cri::Platform.color?(io)
        green(str)
      else
        str
      end
    end
842534
def process_command_line(preset_command: nil)
      prompt = preset_command ? ":#{preset_command} " : ':'
      command_line.set_prompt prompt
      cmd, *args = command_line.get_command(prompt: prompt).split(' ')
      if cmd && !cmd.empty? && respond_to?(cmd)
        ret = self.public_send cmd, *args
        clear_command_line
        ret
      end
    rescue Interrupt
      clear_command_line
    end
39167
protected void process(String cmd) {
        int firstSpace = cmd.indexOf(' ');
        if(firstSpace < 0) firstSpace = cmd.length();

        CommandInfo info = commands.get(cmd.substring(0, firstSpace).toUpperCase());

        if(info == null) {
            sendResponse(502, "Unknown command");
            return;
        }

        processCommand(info, firstSpace != cmd.length() ? cmd.substring(firstSpace + 1) : "");
    }
352492
private function prepare_base_string() {
    $base = array(
      $this->method,
      $this->url,
      $this->signing_params
    );
    $this->base_string = implode('&', $this->safe_encode($base));
  }
1319309
def _prepare_request(self, command, query):
        
        from luckydonaldUtils.encoding import to_native as n
        from pytgbot.api_types.sendable import Sendable
        from pytgbot.api_types import as_array
        from DictObject import DictObject
        import json

        params = {}
        for key in query.keys():
            element = query[key]
            if element is not None:
                if isinstance(element, Sendable):
                    params[key] = json.dumps(as_array(element))
                else:
                    params[key] = element
        url = self._base_url.format(api_key=n(self.api_key), command=n(command))
        return DictObject(url=url, params=params)
519291
function parseCommandLine() {
	var commands = process.argv.slice(2);
	var args = {};

	for (var i = 0; i < commands.length; i++) {
		var match = commands[i].match(/^--(.+)=(.+)$/);
		if (match)
			args[match[1]] = match[2];
		else if (i < commands.length - 1 && commands[i].substr(0, 1) === "-") {
			args[commands[i].substr(1)] = commands[i + 1];
			i++;
		}
		else if (i === 0) args[commandKey] = commands[i];
		else if (i === 1) args[commandHost] = commands[i];
	}

	return args;
}
297213
private void init(final String commandName, final String argumentsString) {
        String fullCommandString;

        String tmpArgumentsString = argumentsString;

        if (tmpArgumentsString != null && !tmpArgumentsString.isEmpty() && tmpArgumentsString.charAt(0) == '!') {
            tmpArgumentsString = tmpArgumentsString.substring(1);
        }

        if (!StringUtils.isBlank(tmpArgumentsString)) {
            fullCommandString = commandName + "!" + tmpArgumentsString;
        } else {
            fullCommandString = commandName;
        }

        this.packet.setType(PacketType.QUERY);
        this.packet.setBuffer(fullCommandString);
        // updateCRC();
    }