How to use the thefuck.specific.sudo.sudo_support function in thefuck

To help you get started, we’ve selected a few thefuck examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nvbn / thefuck / thefuck / rules / apt_invalid_operation.py View on Github external
@sudo_support
def get_new_command(command):
    invalid_operation = command.output.split()[-1]

    if invalid_operation == 'uninstall':
        return [command.script.replace('uninstall', 'remove')]

    else:
        operations = _get_operations(command.script_parts[0])
        return replace_command(command, invalid_operation, operations)
github nvbn / thefuck / thefuck / rules / no_command.py View on Github external
@sudo_support
def match(command):
    return (not which(command.script_parts[0])
            and ('not found' in command.output
                 or 'is not recognized as' in command.output)
            and bool(get_close_matches(command.script_parts[0],
                                       get_all_executables())))
github nvbn / thefuck / thefuck / rules / hostscli.py View on Github external
@sudo_support
@for_app('hostscli')
def match(command):
    errors = [no_command, no_website]
    for error in errors:
        if error in command.output:
            return True
    return False
github nvbn / thefuck / thefuck / rules / python_command.py View on Github external
@sudo_support
def get_new_command(command):
    return 'python ' + command.script
github nvbn / thefuck / thefuck / rules / lein_not_task.py View on Github external
@sudo_support
@for_app('lein')
def match(command):
    return (command.script.startswith('lein')
            and "is not a task. See 'lein help'" in command.output
            and 'Did you mean this?' in command.output)
github nvbn / thefuck / thefuck / rules / fix_alt_space.py View on Github external
@sudo_support
def get_new_command(command):
    return re.sub(u' ', ' ', command.script)
github nvbn / thefuck / thefuck / rules / rm_root.py View on Github external
@sudo_support
def get_new_command(command):
    return u'{} --no-preserve-root'.format(command.script)
github nvbn / thefuck / thefuck / rules / fix_alt_space.py View on Github external
@sudo_support
def match(command):
    return ('command not found' in command.output.lower()
            and u' ' in command.script)
github nvbn / thefuck / thefuck / rules / dnf_no_such_command.py View on Github external
@sudo_support
@for_app('dnf')
def match(command):
    return 'no such command' in command.output.lower()
github nvbn / thefuck / thefuck / rules / apt_invalid_operation.py View on Github external
@sudo_support
@for_app('apt', 'apt-get', 'apt-cache')
def match(command):
    return 'E: Invalid operation' in command.output