Skip to content

Commit

Permalink
Encapsulate force_command in _get_raw_command
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nootr authored and scorphus committed Dec 19, 2021
1 parent c719712 commit 0f4a523
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/entrypoints/test_fix_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

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
Expand Down
2 changes: 1 addition & 1 deletion thefuck/entrypoints/fix_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

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:
Expand Down

1 comment on commit 0f4a523

@Aydendavis6
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried and nothing happened at all it only said fuck

Please sign in to comment.