Returns fixed commands script.

        If `settings.repeat` is `True`, appends command with second attempt
        of running fuck in case fixed command fails again.
325266
def _get_script(self):
        
        if settings.repeat:
            repeat_fuck = '{} --repeat {}--force-command {}'.format(
                get_alias(),
                '--debug ' if settings.debug else '',
                shell.quote(self.script))
            return shell.or_(self.script, repeat_fuck)
        else:
            return self.script
984630
def mod_run_check(onlyif, unless, creates):
    '''
    
    '''
    cmd_kwargs = {'use_vt': False, 'bg': False}

    if onlyif is not None:
        if isinstance(onlyif, six.string_types):
            onlyif = [onlyif]
        if not isinstance(onlyif, list) \
                or not all(isinstance(x, six.string_types) for x in onlyif):
            return {'comment': 'onlyif is not a string or list of strings',
                    'skip_watch': True,
                    'result': True}
        for entry in onlyif:
            retcode = __salt__['cmd.retcode'](
                entry,
                ignore_retcode=True,
                python_shell=True)
            if retcode != 0:
                return {
                    'comment': 'onlyif command {0} returned exit code of {1}'
                               .format(entry, retcode),
                    'skip_watch': True,
                    'result': True
                }

    if unless is not None:
        if isinstance(unless, six.string_types):
            unless = [unless]
        if not isinstance(unless, list) \
                or not all(isinstance(x, six.string_types) for x in unless):
            return {'comment': 'unless is not a string or list of strings',
                    'skip_watch': True,
                    'result': True}
        for entry in unless:
            retcode = __salt__['cmd.retcode'](
                entry,
                ignore_retcode=True,
                python_shell=True)
            if retcode == 0:
                return {
                    'comment': 'unless command {0} returned exit code of {1}'
                               .format(entry, retcode),
                    'skip_watch': True,
                    'result': True
                }

    if creates is not None:
        if isinstance(creates, six.string_types):
            creates = [creates]
        if not isinstance(creates, list) \
                or not all(isinstance(x, six.string_types) for x in creates):
            return {'comment': 'creates is not a string or list of strings',
                    'skip_watch': True,
                    'result': True}
        if all(os.path.exists(x) for x in creates):
            return {'comment': 'All specified paths in \'creates\' '
                               'argument exist',
                    'result': True}

    # No reason to stop, return True
    return True
1291969
def set_commands(self, commands, timeout=None):
        
        self.desired_commands = commands

        target_commands = list(self.desired_commands)
        for process in list(self.processes):
            found = False
            for i in range(len(target_commands)):
                if process["command"] == target_commands[i]:
                    target_commands.pop(i)
                    found = True
                    break

            if not found:
                self.stop_process(process, timeout)

        # What is left are the commands to add
        # TODO: we should only do this once memory conditions allow
        for command in target_commands:
            self.spawn(command)
1142513
def _replace_variable_chunks(self, cmds):
        

        cons_cmd = None
        while cons_cmd is None:
            for cmd in cmds:
                if cons_cmd is None:
                    cons_cmd = cmd[:]
                else:
                    for idx, s in enumerate(cons_cmd):
                        if s not in cmd:
                            cons_cmd[idx] = self.var_html
        return cons_cmd
900577
def get_script_str(self, reset=True):
        """"""
        s = "\n".join(l for l in self._lines)
        if reset:
            self.reset()
        return s
1374004
def rerun(version="3.7.0"):
    
    from commandlib import Command

    Command(DIR.gen.joinpath("py{0}".format(version), "bin", "python"))(
        DIR.gen.joinpath("state", "examplepythoncode.py")
    ).in_dir(DIR.gen.joinpath("state")).run()
796961
def fix_repeating_arguments(self):
        """"""
        either = [list(child.children) for child in transform(self).children]
        for case in either:
            for e in [child for child in case if case.count(child) > 1]:
                if type(e) is Argument or type(e) is Option and e.argcount:
                    if e.value is None:
                        e.value = []
                    elif type(e.value) is not list:
                        e.value = e.value.split()
                if type(e) is Command or type(e) is Option and e.argcount == 0:
                    e.value = 0
        return self
161399
def get_command(self):
        
        cmd = None
        count = len(self.command_list)
        if count > 0:
            cmd = self.command_list.pop(0)
        ## If that was the last line, turn off lines_pending
        if count == 1:
            self.cmd_ready = False
        return cmd
844380
def cmd_repl():
    
    import code
    import rlcompleter  # noqa
    import readline
    import sys

    readline.parse_and_bind("tab: complete")
    shell = code.InteractiveConsole({
        "rocket": rocket,
    })
    shell.interact(banner="%s %s, Python %s on %s" %
                          (APP_NAME, __version__, sys.version, sys.platform))
541474
def replace_command(command, broken, matched):
    """"""
    new_cmds = get_close_matches(broken, matched, cutoff=0.1)
    return [replace_argument(command.script, broken, new_cmd.strip())
            for new_cmd in new_cmds]
255838
def _mod_run_check(cmd_kwargs, onlyif, unless):
    '''
    
    '''
    if onlyif:
        if __salt__['cmd.retcode'](onlyif, **cmd_kwargs) != 0:
            return {'comment': 'onlyif condition is false',
                    'skip_watch': True,
                    'result': True}

    if unless:
        if __salt__['cmd.retcode'](unless, **cmd_kwargs) == 0:
            return {'comment': 'unless condition is true',
                    'skip_watch': True,
                    'result': True}

    # No reason to stop, return True
    return True
398210
def script(state, host, filename, chdir=None):
    '''
    
    '''

    temp_file = state.get_temp_filename(filename)
    yield files.put(state, host, filename, temp_file)

    yield chmod(temp_file, '+x')

    if chdir:
        yield 'cd {0} && {1}'.format(chdir, temp_file)
    else:
        yield temp_file
72549
def fix_hyphen_commands(raw_cli_arguments):
    """"""
    for i in ['gen-sample']:
        raw_cli_arguments[i.replace('-', '_')] = raw_cli_arguments[i]
        raw_cli_arguments.pop(i)
    return raw_cli_arguments
1217239
def get_push_command(self, remote=None, revision=None):
        """"""
        # TODO What about tags?
        command = ['git', '-c', 'push.default=matching', 'push']
        if remote or revision:
            command.append(remote or 'origin')
            if revision:
                command.append(revision)
        return command
259931
function addValidCommands(command) {
		var result = false
		if (command && commands.indexOf(command) != -1) {
			result = true
			commandQueue.push(command)
		}
		return result
	}
85618
def custom_check(cmd, ignore_retcode=False):
    
    p = custom_popen(cmd)
    out, _ = p.communicate()
    if p.returncode and not ignore_retcode:
        raise RarExecError("Check-run failed")
    return out
445599
function getRunScripts (cmd) {
  const re = new RegExp("(?:npm run" + RE_NAME + ")+", "gi")
  return unique(getMatches(re, cmd).map(m => m.match))
}