mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 23:22:10 +00:00 
			
		
		
		
	| @@ -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; | * `mkdir_p` – adds `-p` when you trying to create directory without parent; | ||||||
| * `no_command` – fixes wrong console commands, for example `vom/vim`; | * `no_command` – fixes wrong console commands, for example `vom/vim`; | ||||||
| * `python_command` – prepends `python` when you trying to run not executable/without `./` python script; | * `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; | * `rm_dir` – adds `-rf` when you trying to remove directory; | ||||||
| * `ssh_known_hosts` – removes host from `known_hosts` on warning; | * `ssh_known_hosts` – removes host from `known_hosts` on warning; | ||||||
| * `sudo` – prepends `sudo` to previous command if it failed because of permissions; | * `sudo` – prepends `sudo` to previous command if it failed because of permissions; | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								tests/rules/test_sl_ls.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								tests/rules/test_sl_ls.py
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										14
									
								
								thefuck/rules/sl_ls.py
									
									
									
									
									
										Normal 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' | ||||||
		Reference in New Issue
	
	Block a user