mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 09:39:01 +00:00
Reformat keyword detection if statement
This commit is contained in:
parent
0ad479b4b0
commit
395d69eadb
@ -9,21 +9,16 @@ def match(command):
|
|||||||
def get_new_command(command):
|
def get_new_command(command):
|
||||||
# Find the argument that is the package name
|
# Find the argument that is the package name
|
||||||
for script_part in command.script_parts:
|
for script_part in command.script_parts:
|
||||||
if script_part in ["choco", "cinst", "install"]:
|
if (
|
||||||
|
script_part not in ["choco", "cinst", "install"]
|
||||||
# Need exact match (bc chocolatey is a package)
|
# Need exact match (bc chocolatey is a package)
|
||||||
continue
|
and not script_part.startswith('-')
|
||||||
if script_part.startswith('-'):
|
|
||||||
# Leading hyphens are parameters; some packages contain them though
|
# Leading hyphens are parameters; some packages contain them though
|
||||||
continue
|
and '=' not in script_part and '/' not in script_part
|
||||||
if '=' in script_part or '/' in script_part:
|
|
||||||
# These are certainly parameters
|
# These are certainly parameters
|
||||||
continue
|
):
|
||||||
else:
|
return command.script.replace(script_part, script_part + ".install")
|
||||||
packageName = script_part
|
return []
|
||||||
# Find the name of the broken package, and append metapackage names
|
|
||||||
if not packageName:
|
|
||||||
return False
|
|
||||||
return(command.script.replace(packageName, packageName + ".install"))
|
|
||||||
|
|
||||||
|
|
||||||
enabled_by_default = bool(which("choco")) or bool(which("cinst"))
|
enabled_by_default = bool(which("choco")) or bool(which("cinst"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user