mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 20:11:17 +00:00
#1282: Keep quotes in the script on no_command rule
Co-authored-by: Pablo Santiago Blum de Aguiar <scorphus@gmail.com>
This commit is contained in:
parent
1a1b5200a9
commit
5198b34f24
@ -21,7 +21,8 @@ def history_without_current(mocker):
|
|||||||
('vom file.py', 'vom: not found'),
|
('vom file.py', 'vom: not found'),
|
||||||
('fucck', 'fucck: not found'),
|
('fucck', 'fucck: not found'),
|
||||||
('puthon', "'puthon' is not recognized as an internal or external command"),
|
('puthon', "'puthon' is not recognized as an internal or external command"),
|
||||||
('got commit', 'got: command not found')])
|
('got commit', 'got: command not found'),
|
||||||
|
('gti commit -m "new commit"', 'gti: command not found')])
|
||||||
def test_match(mocker, script, output):
|
def test_match(mocker, script, output):
|
||||||
mocker.patch('thefuck.rules.no_command.which', return_value=None)
|
mocker.patch('thefuck.rules.no_command.which', return_value=None)
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ def test_not_match(mocker, script, output, which):
|
|||||||
@pytest.mark.parametrize('script, result', [
|
@pytest.mark.parametrize('script, result', [
|
||||||
('vom file.py', ['vim file.py']),
|
('vom file.py', ['vim file.py']),
|
||||||
('fucck', ['fsck']),
|
('fucck', ['fsck']),
|
||||||
('got commit', ['git commit', 'go commit'])])
|
('got commit', ['git commit', 'go commit']),
|
||||||
|
('gti commit -m "new commit"', ['git commit -m "new commit"'])])
|
||||||
def test_get_new_command(script, result):
|
def test_get_new_command(script, result):
|
||||||
assert get_new_command(Command(script, '')) == result
|
assert get_new_command(Command(script, '')) == result
|
||||||
|
@ -35,8 +35,7 @@ def get_new_command(command):
|
|||||||
get_all_executables())
|
get_all_executables())
|
||||||
if cmd not in new_cmds]
|
if cmd not in new_cmds]
|
||||||
|
|
||||||
return [' '.join([new_command] + command.script_parts[1:])
|
return [command.script.replace(old_command, cmd, 1) for cmd in new_cmds]
|
||||||
for new_command in new_cmds]
|
|
||||||
|
|
||||||
|
|
||||||
priority = 3000
|
priority = 3000
|
||||||
|
Loading…
x
Reference in New Issue
Block a user