diff --git a/tests/rules/test_vagrant_up.py b/tests/rules/test_vagrant_up.py index 0ede9712..b65e9e40 100644 --- a/tests/rules/test_vagrant_up.py +++ b/tests/rules/test_vagrant_up.py @@ -23,12 +23,12 @@ def test_not_match(command): @pytest.mark.parametrize('command, new_command', [ - (Command(script='vagrant ssh', stderr='VM must be running to open SSH connection. Run `vagrant up`\nto start the virtual machine.'), 'vagrant up && vagrant ssh'), - (Command(script='vagrant ssh devbox', stderr='VM must be running to open SSH connection. Run `vagrant up`\nto start the virtual machine.'), 'vagrant up devbox && vagrant ssh devbox'), + (Command(script='vagrant ssh', stderr='VM must be running to open SSH connection. Run `vagrant up`\nto start the virtual machine.'), 'vagrant up && vagrant ssh'), + (Command(script='vagrant ssh devbox', stderr='VM must be running to open SSH connection. Run `vagrant up`\nto start the virtual machine.'), ['vagrant up devbox && vagrant ssh devbox', 'vagrant up && vagrant ssh devbox']), (Command(script='vagrant rdp', - stderr='VM must be created before running this command. Run `vagrant up` first.'), 'vagrant up && vagrant rdp'), + stderr='VM must be created before running this command. Run `vagrant up` first.'), 'vagrant up && vagrant rdp'), (Command(script='vagrant rdp devbox', - stderr='VM must be created before running this command. Run `vagrant up` first.'), 'vagrant up devbox && vagrant rdp devbox')]) + stderr='VM must be created before running this command. Run `vagrant up` first.'), ['vagrant up devbox && vagrant rdp devbox', 'vagrant up && vagrant rdp devbox'])]) def test_get_new_command(command, new_command): assert get_new_command(command, None) == new_command diff --git a/thefuck/rules/vagrant_up.py b/thefuck/rules/vagrant_up.py index 1c27db48..9c0a1e40 100644 --- a/thefuck/rules/vagrant_up.py +++ b/thefuck/rules/vagrant_up.py @@ -7,7 +7,12 @@ def match(command, settings): def get_new_command(command, settings): cmds = command.script.split(' ') - machine = "" + machine = None if len(cmds) >= 3: machine = cmds[2] - return shells.and_("vagrant up " + machine, command.script) + + startAllInstances = shells.and_("vagrant up", command.script) + if machine is None: + return startAllInstances + else: + return [ shells.and_("vagrant up " + machine, command.script), startAllInstances]