1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 06:38:32 +00:00

change fixed command to use && rather than ;

using && so that incase the install fails the use command doesn't run and error out.
This commit is contained in:
Ryan Callahan 2021-04-15 15:15:04 -04:00
parent 8c5386deb6
commit 865d540bfd
No known key found for this signature in database
GPG Key ID: 1EA116782D6C6338
2 changed files with 5 additions and 4 deletions

View File

@ -19,8 +19,8 @@ def test_match(command):
@pytest.mark.parametrize('command, new_command', [
(Command('rvm use 2.7.2', output), 'rvm install "ruby-2.7.2"; rvm use 2.7.2'),
(Command('rvm use 3.0.1', output), 'rvm install "ruby-3.0.1"; rvm use 3.0.1'),
(Command('rvm use 1.6.7', output), 'rvm install "ruby-1.6.7"; rvm use 1.6.7')])
(Command('rvm use 2.7.2', output), 'rvm install "ruby-2.7.2" && rvm use 2.7.2'),
(Command('rvm use 3.0.1', output), 'rvm install "ruby-3.0.1" && rvm use 3.0.1'),
(Command('rvm use 1.6.7', output), 'rvm install "ruby-1.6.7" && rvm use 1.6.7')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command

View File

@ -1,4 +1,5 @@
from thefuck.utils import for_app
from thefuck.shells import shell
@for_app('rvm', at_least=2)
@ -15,4 +16,4 @@ Please visit https://rvm.io/integration/gnome-terminal/ for an example."""
def get_new_command(command):
args = command.script_parts
return 'rvm install \"ruby-' + args[2] + '\"; rvm use ' + args[2]
return shell.and_('rvm install \"ruby-{}\"'.format(args[2]), 'rvm use {}'.format(args[2]))