mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	Fix aliased yarn commands like yarn ls
				
					
				
			[Yarn] has a handful of subcommand [aliases], but does not automatically
[correct] them for the user. This makes it so that `fuck` will do the
trick. For example:
    $ yarn ls
    yarn ls v0.20.3
    error Did you mean `yarn list`?
    info Visit https://yarnpkg.com/en/docs/cli/list for documentation about this command.
    $ fuck
    yarn list [enter/?/?/ctrl+c]
[Yarn]: https://yarnpkg.com/en/
[aliases]: 0adbc59b18/src/cli/aliases.js
[correct]: https://github.com/yarnpkg/yarn/pull/1044#issuecomment-253763230
			
			
This commit is contained in:
		
							
								
								
									
										22
									
								
								tests/rules/test_yarn_alias.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								tests/rules/test_yarn_alias.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| import pytest | ||||
| from thefuck.rules.yarn_alias import match, get_new_command | ||||
| from tests.utils import Command | ||||
|  | ||||
|  | ||||
| stderr_remove = 'error Did you mean `yarn remove`?' | ||||
|  | ||||
| stderr_list = 'error Did you mean `yarn list`?' | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('command', [ | ||||
|     Command(script='yarn rm', stderr=stderr_remove), | ||||
|     Command(script='yarn ls', stderr=stderr_list)]) | ||||
| def test_match(command): | ||||
|     assert match(command) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('command, new_command', [ | ||||
|     (Command('yarn rm', stderr=stderr_remove), 'yarn remove'), | ||||
|     (Command('yarn ls', stderr=stderr_list), 'yarn list')]) | ||||
| def test_get_new_command(command, new_command): | ||||
|     assert get_new_command(command) == new_command | ||||
		Reference in New Issue
	
	Block a user