1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-31 02:01:13 +00:00

Merge pull request #106 from Brobin/master

New rule: sl -> ls
This commit is contained in:
Vladimir Iakovlev 2015-04-23 15:01:57 +02:00
commit 1f38e0a932
3 changed files with 27 additions and 0 deletions

View File

@ -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;

12
tests/rules/test_sl_ls.py Normal file
View File

@ -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'

14
thefuck/rules/sl_ls.py Normal file
View File

@ -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'