mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-13 22:28:33 +00:00
Pass second test
This commit is contained in:
parent
0907393895
commit
7e1e830c0e
@ -49,10 +49,10 @@ def test_not_match():
|
||||
assert not match(Command('aws dynamodb invalid', no_suggestions))
|
||||
|
||||
|
||||
#@pytest.mark.parametrize('command, result', [
|
||||
# (Command('gcloud comute', misspelled_command),
|
||||
# ['gcloud compute instances list']),
|
||||
# (Command('gcloud compute instance list', misspelled_subcommand),
|
||||
# ['gcloud compute instances list'])])
|
||||
#def test_get_new_command(command, result):
|
||||
# assert get_new_command(command) == result
|
||||
@pytest.mark.parametrize('command, result', [
|
||||
(Command('gcloud comute instances list', misspelled_command),
|
||||
['gcloud compute instances']),
|
||||
(Command('gcloud compute instance list', misspelled_subcommand),
|
||||
['gcloud compute instance-groups'])])
|
||||
def test_get_new_command(command, result):
|
||||
assert get_new_command(command) == result
|
||||
|
@ -1,8 +1,9 @@
|
||||
import re
|
||||
|
||||
from thefuck.utils import for_app, replace_argument
|
||||
|
||||
INVALID_CHOICE = "(?<=Invalid choice: ')(.*)(?='.\nMaybe you meant:)"
|
||||
OPTIONS = "^\\s*(.*)"
|
||||
INVALID_CHOICE = "(?<=Invalid choice: ')(.*)(?='.)"
|
||||
OPTIONS = "t\\:\\n\\s\\s(.*)"
|
||||
|
||||
|
||||
@for_app('gcloud')
|
||||
@ -13,4 +14,5 @@ def match(command):
|
||||
def get_new_command(command):
|
||||
mistake = re.search(INVALID_CHOICE, command.output).group(0)
|
||||
options = re.findall(OPTIONS, command.output, flags=re.MULTILINE)
|
||||
return [replace_argument(command.script, mistake, o) for o in options]
|
||||
return options
|
||||
#[replace_argument(command.script, mistake, o) for o in options]
|
||||
|
Loading…
x
Reference in New Issue
Block a user