1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-20 20:09:07 +00:00

Fix the open rule

It was simply wrong with `xdg-`, `gnome-` and `kde-open`.
This commit is contained in:
mcarton 2015-08-17 16:22:05 +02:00
parent bc6b107066
commit 1becd92b12
2 changed files with 9 additions and 3 deletions

View File

@ -9,7 +9,10 @@ from tests.utils import Command
Command(script='open foo.org'),
Command(script='open foo.net'),
Command(script='open foo.se'),
Command(script='open foo.io')])
Command(script='open foo.io'),
Command(script='xdg-open foo.com'),
Command(script='gnome-open foo.com'),
Command(script='kde-open foo.com')])
def test_match(command):
assert match(command, None)
@ -20,6 +23,9 @@ def test_match(command):
(Command('open foo.org'), 'open http://foo.org'),
(Command('open foo.net'), 'open http://foo.net'),
(Command('open foo.se'), 'open http://foo.se'),
(Command('open foo.io'), 'open http://foo.io')])
(Command('open foo.io'), 'open http://foo.io'),
(Command('xdg-open foo.io'), 'xdg-open http://foo.io'),
(Command('gnome-open foo.io'), 'gnome-open http://foo.io'),
(Command('kde-open foo.io'), 'kde-open http://foo.io')])
def test_get_new_command(command, new_command):
assert get_new_command(command, None) == new_command

View File

@ -23,4 +23,4 @@ def match(command, settings):
def get_new_command(command, settings):
return 'open http://' + command.script[5:]
return command.script.replace('open ', 'open http://')