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

Pass second test

This commit is contained in:
Ronan Doolan 2020-05-09 19:21:52 +01:00
parent 0907393895
commit 7e1e830c0e
2 changed files with 12 additions and 10 deletions

View File

@ -49,10 +49,10 @@ def test_not_match():
assert not match(Command('aws dynamodb invalid', no_suggestions)) assert not match(Command('aws dynamodb invalid', no_suggestions))
#@pytest.mark.parametrize('command, result', [ @pytest.mark.parametrize('command, result', [
# (Command('gcloud comute', misspelled_command), (Command('gcloud comute instances list', misspelled_command),
# ['gcloud compute instances list']), ['gcloud compute instances']),
# (Command('gcloud compute instance list', misspelled_subcommand), (Command('gcloud compute instance list', misspelled_subcommand),
# ['gcloud compute instances list'])]) ['gcloud compute instance-groups'])])
#def test_get_new_command(command, result): def test_get_new_command(command, result):
# assert get_new_command(command) == result assert get_new_command(command) == result

View File

@ -1,8 +1,9 @@
import re
from thefuck.utils import for_app, replace_argument from thefuck.utils import for_app, replace_argument
INVALID_CHOICE = "(?<=Invalid choice: ')(.*)(?='.\nMaybe you meant:)" INVALID_CHOICE = "(?<=Invalid choice: ')(.*)(?='.)"
OPTIONS = "^\\s*(.*)" OPTIONS = "t\\:\\n\\s\\s(.*)"
@for_app('gcloud') @for_app('gcloud')
@ -13,4 +14,5 @@ def match(command):
def get_new_command(command): def get_new_command(command):
mistake = re.search(INVALID_CHOICE, command.output).group(0) mistake = re.search(INVALID_CHOICE, command.output).group(0)
options = re.findall(OPTIONS, command.output, flags=re.MULTILINE) 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]