1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-20 01:28:56 +00:00

Remove multiple returns

This commit is contained in:
p73632 2019-12-12 11:53:33 +00:00
parent 794cab8842
commit a2cfa53913
2 changed files with 6 additions and 7 deletions

View File

@ -59,7 +59,7 @@ def test_get_branches(branches, branch_list, git_branch):
['git checkout -b unknown']), ['git checkout -b unknown']),
(b'', (b'',
Command('git commit unknown', did_not_match('unknown')), Command('git commit unknown', did_not_match('unknown')),
'git branch unknown && git commit unknown'), ['git branch unknown && git commit unknown']),
(b' test-random-branch-123', (b' test-random-branch-123',
Command('git checkout tst-rdm-brnch-123', Command('git checkout tst-rdm-brnch-123',
did_not_match('tst-rdm-brnch-123')), did_not_match('tst-rdm-brnch-123')),

View File

@ -42,9 +42,8 @@ def get_new_command(command):
if command.script_parts[1] == 'checkout': if command.script_parts[1] == 'checkout':
new_commands.append(replace_argument(command.script, 'checkout', 'checkout -b')) new_commands.append(replace_argument(command.script, 'checkout', 'checkout -b'))
if new_commands: if not new_commands:
return new_commands new_commands.append(shell.and_('git branch {}', '{}').format(
else: missing_file, command.script))
# if neither the better options above match, then resort to this
return shell.and_('git branch {}', '{}').format( return new_commands
missing_file, command.script)