From 0f4a523dc4cab990641131a7aac90b67bf7fb5fc Mon Sep 17 00:00:00 2001 From: Joris Hartog Date: Fri, 22 Oct 2021 00:04:33 +0200 Subject: [PATCH] Encapsulate force_command in _get_raw_command Using the `force_command` argument will run into issues as the `_get_raw_command` method simply returns the value of `force_command` (which is a string) while it should actually return a list. Fix #1240 --- tests/entrypoints/test_fix_command.py | 4 ++-- thefuck/entrypoints/fix_command.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/entrypoints/test_fix_command.py b/tests/entrypoints/test_fix_command.py index 18431c46..3012bb4f 100644 --- a/tests/entrypoints/test_fix_command.py +++ b/tests/entrypoints/test_fix_command.py @@ -5,8 +5,8 @@ from thefuck.entrypoints.fix_command import _get_raw_command class TestGetRawCommand(object): def test_from_force_command_argument(self): - known_args = Mock(force_command=['git', 'brunch']) - assert _get_raw_command(known_args) == ['git', 'brunch'] + known_args = Mock(force_command='git brunch') + assert _get_raw_command(known_args) == ['git brunch'] def test_from_command_argument(self, os_environ): os_environ['TF_HISTORY'] = None diff --git a/thefuck/entrypoints/fix_command.py b/thefuck/entrypoints/fix_command.py index 6946653e..018ba580 100644 --- a/thefuck/entrypoints/fix_command.py +++ b/thefuck/entrypoints/fix_command.py @@ -12,7 +12,7 @@ from ..utils import get_alias, get_all_executables def _get_raw_command(known_args): if known_args.force_command: - return known_args.force_command + return [known_args.force_command] elif not os.environ.get('TF_HISTORY'): return known_args.command else: