diff --git a/thefuck/rules/choco_install.py b/thefuck/rules/choco_install.py index 005b12fc..f9206117 100644 --- a/thefuck/rules/choco_install.py +++ b/thefuck/rules/choco_install.py @@ -9,21 +9,16 @@ def match(command): def get_new_command(command): # Find the argument that is the package name for script_part in command.script_parts: - if script_part in ["choco", "cinst", "install"]: - # Need exact match (bc chocolatey is a package) - continue - if script_part.startswith('-'): - # Leading hyphens are parameters; some packages contain them though - continue - if '=' in script_part or '/' in script_part: - # These are certainly parameters - continue - else: - packageName = script_part - # Find the name of the broken package, and append metapackage names - if not packageName: - return False - return(command.script.replace(packageName, packageName + ".install")) + if ( + script_part not in ["choco", "cinst", "install"] + # Need exact match (bc chocolatey is a package) + and not script_part.startswith('-') + # Leading hyphens are parameters; some packages contain them though + and '=' not in script_part and '/' not in script_part + # These are certainly parameters + ): + return command.script.replace(script_part, script_part + ".install") + return [] enabled_by_default = bool(which("choco")) or bool(which("cinst"))