mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 09:39:01 +00:00
Apply suggestions from code review
Circling back to retest Co-Authored-By: Pablo Aguiar <scorphus@gmail.com>
This commit is contained in:
parent
05e0696ac7
commit
e8e2f59ee1
@ -1,14 +1,15 @@
|
|||||||
|
from thefuck.utils import for_app
|
||||||
|
|
||||||
|
|
||||||
|
@for_app("choco", "cinst")
|
||||||
def match(command):
|
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)
|
and 'Installing the following packages' in command.output)
|
||||||
|
|
||||||
|
|
||||||
def get_new_command(command):
|
def get_new_command(command):
|
||||||
cmdList = command.script.split(' ')
|
|
||||||
packageName = ""
|
|
||||||
# Find the argument that is the package name
|
# Find the argument that is the package name
|
||||||
for i in cmdList:
|
for script_part in command.script_parts:
|
||||||
print(i)
|
|
||||||
if "choco" in i:
|
if "choco" in i:
|
||||||
continue
|
continue
|
||||||
if "cinst" in i:
|
if "cinst" in i:
|
||||||
@ -27,3 +28,6 @@ def get_new_command(command):
|
|||||||
if not packageName:
|
if not packageName:
|
||||||
return False
|
return False
|
||||||
return(command.script.replace(packageName, packageName + ".install"))
|
return(command.script.replace(packageName, packageName + ".install"))
|
||||||
|
|
||||||
|
|
||||||
|
enabled_by_default = bool(which("choco")) or bool(which("cinst"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user