mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	rewritten match + fish output check for cd_* rules
This commit is contained in:
		| @@ -1,5 +1,5 @@ | |||||||
| import pytest | import pytest | ||||||
| from thefuck.rules.cd_correction import match, get_new_command | from thefuck.rules.cd_correction import match | ||||||
| from thefuck.types import Command | from thefuck.types import Command | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,9 +21,12 @@ def _get_sub_dirs(parent): | |||||||
| @for_app('cd') | @for_app('cd') | ||||||
| def match(command): | def match(command): | ||||||
|     """Match function copied from cd_mkdir.py""" |     """Match function copied from cd_mkdir.py""" | ||||||
|     return (command.script.startswith('cd ') |     return ( | ||||||
|             and ('no such file or directory' in command.output.lower() |         command.script.startswith('cd ') and any(( | ||||||
|                  or 'cd: can\'t cd to' in command.output.lower())) |             'no such file or directory' in command.output.lower(), | ||||||
|  |             'cd: can\'t cd to' in command.output.lower(), | ||||||
|  |             'does not exist' in command.output.lower() | ||||||
|  |         ))) | ||||||
|  |  | ||||||
|  |  | ||||||
| @sudo_support | @sudo_support | ||||||
|   | |||||||
| @@ -8,10 +8,11 @@ from thefuck.shells import shell | |||||||
| @for_app('cd') | @for_app('cd') | ||||||
| def match(command): | def match(command): | ||||||
|     return ( |     return ( | ||||||
|         'no such file or directory' in command.output.lower() |         command.script.startswith('cd ') and any(( | ||||||
|         or 'cd: can\'t cd to' in command.output.lower() |             'no such file or directory' in command.output.lower(), | ||||||
|         or 'the system cannot find the path specified.' in command.output.lower() |             'cd: can\'t cd to' in command.output.lower(), | ||||||
|     ) |             'does not exist' in command.output.lower() | ||||||
|  |         ))) | ||||||
|  |  | ||||||
|  |  | ||||||
| @sudo_support | @sudo_support | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user