From 8e8c80c22757508cb54f5fb17c67a7fb925dd0e1 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Fri, 23 Jul 2021 20:05:06 +0200 Subject: [PATCH] #1188: Remove only leading whitespace chars from script Fix #1188 --- tests/test_types.py | 4 +++- thefuck/utils.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_types.py b/tests/test_types.py index 3a43cde..a322d21 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -143,7 +143,9 @@ class TestCommand(object): ([''], None), (['', ''], None), (['ls', '-la'], 'ls -la'), - (['ls'], 'ls')]) + (['ls'], 'ls'), + (['echo \\ '], 'echo \\ '), + (['echo \\\n'], 'echo \\\n')]) def test_from_script(self, script, result): if result: assert Command.from_raw_script(script).script == result diff --git a/thefuck/utils.py b/thefuck/utils.py index 42f3263..466e4ba 100644 --- a/thefuck/utils.py +++ b/thefuck/utils.py @@ -344,4 +344,4 @@ def format_raw_script(raw_script): else: script = ' '.join(raw_script) - return script.strip() + return script.lstrip()