mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-18 03:56:01 +00:00
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
This commit is contained in:
parent
c719712b62
commit
0f4a523dc4
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user