mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-31 15:12:20 +00:00 
			
		
		
		
	Merge branch 'apt_get_not_installed' of git://github.com/juzim/thefuck into juzim-apt_get_not_installed
This commit is contained in:
		| @@ -7,6 +7,8 @@ from tests.utils import Command | |||||||
|     (Command(script='vim', stderr='vim: command not found'), |     (Command(script='vim', stderr='vim: command not found'), | ||||||
|      [('vim', 'main'), ('vim-tiny', 'main')]), |      [('vim', 'main'), ('vim-tiny', 'main')]), | ||||||
|     (Command(script='sudo vim', stderr='vim: command not found'), |     (Command(script='sudo vim', stderr='vim: command not found'), | ||||||
|  |      [('vim', 'main'), ('vim-tiny', 'main')]), | ||||||
|  |     (Command(script='vim', stderr="The program 'vim' is currently not installed. You can install it by typing: sudo apt install vim"), | ||||||
|      [('vim', 'main'), ('vim-tiny', 'main')])]) |      [('vim', 'main'), ('vim-tiny', 'main')])]) | ||||||
| def test_match(mocker, command, packages): | def test_match(mocker, command, packages): | ||||||
|     mocker.patch('thefuck.rules.apt_get.which', return_value=None) |     mocker.patch('thefuck.rules.apt_get.which', return_value=None) | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| from thefuck.specific.apt import apt_available | from thefuck.specific.apt import apt_available | ||||||
| from thefuck.utils import memoize, which | from thefuck.utils import memoize, which | ||||||
| from thefuck.shells import shell | from thefuck.shells import shell | ||||||
|  | from pprint import pprint | ||||||
|  |  | ||||||
| try: | try: | ||||||
|     from CommandNotFound import CommandNotFound |     from CommandNotFound import CommandNotFound | ||||||
| @@ -29,7 +30,7 @@ def get_package(executable): | |||||||
|  |  | ||||||
|  |  | ||||||
| def match(command): | def match(command): | ||||||
|     if 'not found' in command.stderr: |     if 'not found' in command.stderr or 'not installed' in command.stderr: | ||||||
|         executable = _get_executable(command) |         executable = _get_executable(command) | ||||||
|         return not which(executable) and get_package(executable) |         return not which(executable) and get_package(executable) | ||||||
|     else: |     else: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user