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

Fixed flake errors

This commit is contained in:
Philip Arola 2019-10-30 11:47:59 -07:00
parent 395d69eadb
commit fdf26a652d
2 changed files with 5 additions and 4 deletions

View File

@ -13,6 +13,6 @@ from thefuck.types import Command
('choco install logstitcher -y -n=test /env', 'choco install logstitcher.install -y -n=test /env'),
('cinst logstitcher -y -n=test /env', 'cinst logstitcher.install -y -n=test /env'),
('choco install chocolatey -y', 'choco install chocolatey.install -y'),
('cinst chocolatey -y', 'cinst chocolatey.install -y'),])
('cinst chocolatey -y', 'cinst chocolatey.install -y'), ])
def test_get_new_command(before, after):
assert (get_new_command(Command(before, '')) == after)

View File

@ -1,5 +1,6 @@
from thefuck.utils import for_app, which
@for_app("choco", "cinst")
def match(command):
return ((command.script.startswith('choco install') or 'cinst' in command.script_parts)
@ -11,11 +12,11 @@ def get_new_command(command):
for script_part in command.script_parts:
if (
script_part not in ["choco", "cinst", "install"]
# Need exact match (bc chocolatey is a package)
# Need exact match (bc chocolatey is a package)
and not script_part.startswith('-')
# Leading hyphens are parameters; some packages contain them though
# Leading hyphens are parameters; some packages contain them though
and '=' not in script_part and '/' not in script_part
# These are certainly parameters
# These are certainly parameters
):
return command.script.replace(script_part, script_part + ".install")
return []