mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-20 20:09:07 +00:00
Support for either starting only the machine requested, or starting all machines
This commit is contained in:
parent
7cb0388ed0
commit
feb3eee2a0
@ -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
|
||||
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user