mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-19 12:24:29 +00:00
Set number of blank lines as two
This commit is contained in:
parent
e304a370cd
commit
7b44c3d2f2
@ -37,15 +37,18 @@ To search the help text of gcloud commands, run:
|
|||||||
gcloud help -- SEARCH_TERMS
|
gcloud help -- SEARCH_TERMS
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('command', [
|
@pytest.mark.parametrize('command', [
|
||||||
Command('gcloud comute', misspelled_command),
|
Command('gcloud comute', misspelled_command),
|
||||||
Command('gcloud compute instance list', misspelled_subcommand)])
|
Command('gcloud compute instance list', misspelled_subcommand)])
|
||||||
def test_match(command):
|
def test_match(command):
|
||||||
assert match(command)
|
assert match(command)
|
||||||
|
|
||||||
|
|
||||||
def test_not_match():
|
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', misspelled_command),
|
||||||
['gcloud compute instances list']),
|
['gcloud compute instances list']),
|
||||||
|
@ -5,10 +5,12 @@ from thefuck.utils import for_app, replace_argument
|
|||||||
INVALID_CHOICE = "(?<=Invalid choice: ')(.*)(?=', maybe you meant:)"
|
INVALID_CHOICE = "(?<=Invalid choice: ')(.*)(?=', maybe you meant:)"
|
||||||
OPTIONS = "^\\s*\\*\\s(.*)"
|
OPTIONS = "^\\s*\\*\\s(.*)"
|
||||||
|
|
||||||
|
|
||||||
@for_app('gcloud')
|
@for_app('gcloud')
|
||||||
def match(command):
|
def match(command):
|
||||||
return "usage:" in command.output and "maybe you meant:" in command.output
|
return "usage:" in command.output and "maybe you meant:" in command.output
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user