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

Apply suggestions from code review

Circling back to retest

Co-Authored-By: Pablo Aguiar <scorphus@gmail.com>
This commit is contained in:
Philip Arola 2019-10-29 17:11:42 -07:00 committed by GitHub
parent 05e0696ac7
commit e8e2f59ee1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,14 +1,15 @@
from thefuck.utils import for_app
@for_app("choco", "cinst")
def match(command):
return (('choco install' in command.script_parts or 'cinst' in command.script_parts)
return ((command.script.startswith('choco install') or 'cinst' in command.script_parts)
and 'Installing the following packages' in command.output)
def get_new_command(command):
cmdList = command.script.split(' ')
packageName = ""
# Find the argument that is the package name
for i in cmdList:
print(i)
for script_part in command.script_parts:
if "choco" in i:
continue
if "cinst" in i:
@ -27,3 +28,6 @@ def get_new_command(command):
if not packageName:
return False
return(command.script.replace(packageName, packageName + ".install"))
enabled_by_default = bool(which("choco")) or bool(which("cinst"))