mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-20 09:39:01 +00:00
revert
This commit is contained in:
parent
619fc2252f
commit
acbf917f5b
@ -1,24 +0,0 @@
|
|||||||
import pytest
|
|
||||||
|
|
||||||
from thefuck.rules.conda_mistype import match, get_new_command
|
|
||||||
from thefuck.types import Command
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def mistype_response():
|
|
||||||
return """
|
|
||||||
|
|
||||||
CommandNotFoundError: No command 'conda lst'.
|
|
||||||
Did you mean 'conda list'?
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def test_match(mistype_response):
|
|
||||||
assert match(Command('conda lst', mistype_response))
|
|
||||||
err_response = 'bash: codna: command not found'
|
|
||||||
assert not match(Command('codna list', err_response))
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_new_command(mistype_response):
|
|
||||||
assert (get_new_command(Command('conda lst', mistype_response)) == ['conda list'])
|
|
@ -1,16 +0,0 @@
|
|||||||
import re
|
|
||||||
from thefuck.utils import get_all_matched_commands, replace_command
|
|
||||||
|
|
||||||
|
|
||||||
def match(command):
|
|
||||||
'''
|
|
||||||
Match a mistyped command
|
|
||||||
'''
|
|
||||||
return 'conda' in command.script and "Did you mean 'conda" in command.output
|
|
||||||
|
|
||||||
|
|
||||||
def get_new_command(command):
|
|
||||||
match = re.findall(r"'conda ([^']*)'", command.output)
|
|
||||||
broken_cmd = match[0]
|
|
||||||
correct_cmd = match[1]
|
|
||||||
return replace_command(command, broken_cmd, [correct_cmd])
|
|
Loading…
x
Reference in New Issue
Block a user