From 01ce65047a1cd2e21b36fa0b2cee0b7be676ebe3 Mon Sep 17 00:00:00 2001 From: mcarton Date: Fri, 26 Jun 2015 11:27:04 +0200 Subject: [PATCH 1/3] Use spaces instead of tabs This is more common in python and follows other rules usage. --- thefuck/rules/open.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/thefuck/rules/open.py b/thefuck/rules/open.py index c799b0a4..cc6f5860 100644 --- a/thefuck/rules/open.py +++ b/thefuck/rules/open.py @@ -1,24 +1,23 @@ # Opens URL's in the default web browser -# +# # Example: # > open github.com # The file ~/github.com does not exist. # Perhaps you meant 'http://github.com'? # -# + def match(command, settings): - return (command.script.startswith ('open') - and ( - # Wanted to use this: - # 'http' in command.stderr - '.com' in command.script - or '.net' in command.script - or '.org' in command.script - or '.ly' in command.script - or '.io' in command.script - or '.se' in command.script - or '.edu' in command.script)) + return (command.script.startswith('open') + and ( + '.com' in command.script + or '.net' in command.script + or '.org' in command.script + or '.ly' in command.script + or '.io' in command.script + or '.se' in command.script + or '.edu' in command.script)) + def get_new_command(command, settings): - return 'open http://' + command.script[5:] + return 'open http://' + command.script[5:] From ef504b6436a1be0a412b0f9bb0bc76365ceb5cdb Mon Sep 17 00:00:00 2001 From: mcarton Date: Fri, 26 Jun 2015 11:32:04 +0200 Subject: [PATCH 2/3] Add a few other common patterns for the open rule --- thefuck/rules/open.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/thefuck/rules/open.py b/thefuck/rules/open.py index cc6f5860..204641fd 100644 --- a/thefuck/rules/open.py +++ b/thefuck/rules/open.py @@ -16,7 +16,10 @@ def match(command, settings): or '.ly' in command.script or '.io' in command.script or '.se' in command.script - or '.edu' in command.script)) + or '.edu' in command.script + or '.info' in command.script + or '.me' in command.script + or 'www.' in command.script)) def get_new_command(command, settings): From ab55c1cccb24901d369eb9182fe15f91f9cff91d Mon Sep 17 00:00:00 2001 From: mcarton Date: Fri, 26 Jun 2015 11:35:57 +0200 Subject: [PATCH 3/3] Add other flavors of open command --- thefuck/rules/open.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thefuck/rules/open.py b/thefuck/rules/open.py index 204641fd..756f2884 100644 --- a/thefuck/rules/open.py +++ b/thefuck/rules/open.py @@ -8,7 +8,7 @@ def match(command, settings): - return (command.script.startswith('open') + return (command.script.startswith(('open', 'xdg-open', 'gnome-open', 'kde-open')) and ( '.com' in command.script or '.net' in command.script