From 5de020bccd2a7ea6ba34087fef06f08df09ced41 Mon Sep 17 00:00:00 2001 From: Brobin Date: Wed, 22 Apr 2015 20:41:56 -0500 Subject: [PATCH 1/3] unf*ck sl -> ls --- thefuck/rules/sl_ls.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 thefuck/rules/sl_ls.py diff --git a/thefuck/rules/sl_ls.py b/thefuck/rules/sl_ls.py new file mode 100644 index 00000000..0b3d017a --- /dev/null +++ b/thefuck/rules/sl_ls.py @@ -0,0 +1,14 @@ +""" +This happens way too often + +When typing really fast cause I'm a 1337 H4X0R, +I often fuck up 'ls' and type 'sl'. No more! +""" + + +def match(command, settings): + return command.script == 'sl' + + +def get_new_command(command, settings): + return 'ls' From 776ff4e3dbe1337e68bef24483d92d29cd45f06f Mon Sep 17 00:00:00 2001 From: Brobin Date: Wed, 22 Apr 2015 20:45:12 -0500 Subject: [PATCH 2/3] updated readme for sl_ls --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 6d584ed2..ec680efb 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,7 @@ using matched rule and run it. Rules enabled by default: * `mkdir_p` – adds `-p` when you trying to create directory without parent; * `no_command` – fixes wrong console commands, for example `vom/vim`; * `python_command` – prepends `python` when you trying to run not executable/without `./` python script; +* `sl_ls` – changes `sl` to `ls`; * `rm_dir` – adds `-rf` when you trying to remove directory; * `ssh_known_hosts` – removes host from `known_hosts` on warning; * `sudo` – prepends `sudo` to previous command if it failed because of permissions; From 157e3e95fc56353d3961d1ebde7a703103e7b335 Mon Sep 17 00:00:00 2001 From: Brobin Date: Wed, 22 Apr 2015 20:51:18 -0500 Subject: [PATCH 3/3] added sl_ls test :shipit: --- tests/rules/test_sl_ls.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/rules/test_sl_ls.py diff --git a/tests/rules/test_sl_ls.py b/tests/rules/test_sl_ls.py new file mode 100644 index 00000000..fd83b04d --- /dev/null +++ b/tests/rules/test_sl_ls.py @@ -0,0 +1,12 @@ + +from thefuck.types import Command +from thefuck.rules.sl_ls import match, get_new_command + + +def test_match(): + assert match(Command('sl', '', ''), None) + assert not match(Command('ls', '', ''), None) + + +def test_get_new_command(): + assert get_new_command(Command('sl', '', ''), None) == 'ls'