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

#N/A: Fix invalid escape sequences

This commit is contained in:
Pablo Santiago Blum de Aguiar 2018-10-25 23:58:06 +02:00
parent 1a9960a7f4
commit 989af57bfe
5 changed files with 6 additions and 6 deletions

View File

@ -9,7 +9,7 @@ def output():
'If you meant to search for a literal string, run ag with -Q\n')
@pytest.mark.parametrize('script', ['ag \('])
@pytest.mark.parametrize('script', ['ag \\('])
def test_match(script, output):
assert match(Command(script, output))
@ -20,6 +20,6 @@ def test_not_match(script):
@pytest.mark.parametrize('script, new_cmd', [
('ag \(', 'ag -Q \(')])
('ag \\(', 'ag -Q \\(')])
def test_get_new_command(script, new_cmd, output):
assert get_new_command((Command(script, output))) == new_cmd

View File

@ -3,7 +3,7 @@ import re
from thefuck.utils import for_app, replace_argument
INVALID_CHOICE = "(?<=Invalid choice: ')(.*)(?=', maybe you meant:)"
OPTIONS = "^\s*\*\s(.*)"
OPTIONS = "^\\s*\\*\\s(.*)"
@for_app('aws')

View File

@ -3,7 +3,7 @@ import re
from thefuck.utils import for_app, replace_argument
INVALID_CHOICE = "(?=az)(?:.*): '(.*)' is not in the '.*' command group."
OPTIONS = "^The most similar choice to '.*' is:\n\s*(.*)$"
OPTIONS = "^The most similar choice to '.*' is:\n\\s*(.*)$"
@for_app('az')

View File

@ -8,5 +8,5 @@ def match(command):
def get_new_command(command):
apps = re.findall('([^ ]*) \([^)]*\)', command.output)
apps = re.findall('([^ ]*) \\([^)]*\\)', command.output)
return [command.script + ' --app ' + app for app in apps]

View File

@ -82,7 +82,7 @@ class Generic(object):
encoded = self.encode_utf8(command)
try:
splitted = [s.replace("??", "\ ") for s in shlex.split(encoded.replace('\ ', '??'))]
splitted = [s.replace("??", "\\ ") for s in shlex.split(encoded.replace('\\ ', '??'))]
except ValueError:
splitted = encoded.split(' ')