mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-21 20:38:54 +00:00
Fix some spelling mistakes
This commit is contained in:
parent
15d19fdf9c
commit
6754ebe20d
@ -2,7 +2,7 @@ import pytest
|
|||||||
|
|
||||||
from tests.utils import Command
|
from tests.utils import Command
|
||||||
from thefuck.rules.mercurial import (
|
from thefuck.rules.mercurial import (
|
||||||
extract_possisiblities, match, get_new_command
|
extract_possibilities, match, get_new_command
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -96,8 +96,8 @@ def test_not_match(command):
|
|||||||
'\n rebase recover remove rename resolve revert'
|
'\n rebase recover remove rename resolve revert'
|
||||||
)), ['rebase', 'recover', 'remove', 'rename', 'resolve', 'revert']),
|
)), ['rebase', 'recover', 'remove', 'rename', 'resolve', 'revert']),
|
||||||
])
|
])
|
||||||
def test_extract_possisiblities(command, possibilities):
|
def test_extract_possibilities(command, possibilities):
|
||||||
assert extract_possisiblities(command) == possibilities
|
assert extract_possibilities(command) == possibilities
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('command, new_command', [
|
@pytest.mark.parametrize('command, new_command', [
|
||||||
|
@ -13,12 +13,12 @@ def _is_tar_extract(cmd):
|
|||||||
|
|
||||||
|
|
||||||
def _tar_file(cmd):
|
def _tar_file(cmd):
|
||||||
tar_extentions = ('.tar', '.tar.Z', '.tar.bz2', '.tar.gz', '.tar.lz',
|
tar_extensions = ('.tar', '.tar.Z', '.tar.bz2', '.tar.gz', '.tar.lz',
|
||||||
'.tar.lzma', '.tar.xz', '.taz', '.tb2', '.tbz', '.tbz2',
|
'.tar.lzma', '.tar.xz', '.taz', '.tb2', '.tbz', '.tbz2',
|
||||||
'.tgz', '.tlz', '.txz', '.tz')
|
'.tgz', '.tlz', '.txz', '.tz')
|
||||||
|
|
||||||
for c in cmd.split():
|
for c in cmd.split():
|
||||||
for ext in tar_extentions:
|
for ext in tar_extensions:
|
||||||
if c.endswith(ext):
|
if c.endswith(ext):
|
||||||
return (c, c[0:len(c)-len(ext)])
|
return (c, c[0:len(c)-len(ext)])
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import re
|
|||||||
from thefuck.utils import get_closest
|
from thefuck.utils import get_closest
|
||||||
|
|
||||||
|
|
||||||
def extract_possisiblities(command):
|
def extract_possibilities(command):
|
||||||
possib = re.findall(r'\n\(did you mean one of ([^\?]+)\?\)', command.stderr)
|
possib = re.findall(r'\n\(did you mean one of ([^\?]+)\?\)', command.stderr)
|
||||||
if possib:
|
if possib:
|
||||||
return possib[0].split(', ')
|
return possib[0].split(', ')
|
||||||
@ -24,6 +24,6 @@ def match(command, settings):
|
|||||||
|
|
||||||
def get_new_command(command, settings):
|
def get_new_command(command, settings):
|
||||||
script = command.script.split(' ')
|
script = command.script.split(' ')
|
||||||
possisiblities = extract_possisiblities(command)
|
possibilities = extract_possibilities(command)
|
||||||
script[1] = get_closest(script[1], possisiblities)
|
script[1] = get_closest(script[1], possibilities)
|
||||||
return ' '.join(script)
|
return ' '.join(script)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user