1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00

Reformat keyword detection if statement

This commit is contained in:
Philip Arola 2019-10-30 11:33:46 -07:00
parent 0ad479b4b0
commit 395d69eadb

View File

@ -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"))