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:
parent
0907393895
commit
7e1e830c0e
@ -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
|
||||||
|
@ -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]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user