From 3bbd0e94633ca68c7c5e7919bd6cbf4f29aee4c3 Mon Sep 17 00:00:00 2001 From: thatneat Date: Tue, 17 Sep 2019 11:02:45 -0700 Subject: [PATCH] Correct "apt uninstall" -> "apt remove" (#950) * Correct "apt uninstall" -> "apt remove" * remove unused import --- tests/rules/test_apt_invalid_operation.py | 2 ++ thefuck/rules/apt_invalid_operation.py | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/rules/test_apt_invalid_operation.py b/tests/rules/test_apt_invalid_operation.py index 7b9fcde..bc7b8c9 100644 --- a/tests/rules/test_apt_invalid_operation.py +++ b/tests/rules/test_apt_invalid_operation.py @@ -116,6 +116,8 @@ def test_get_operations(set_help, app, help_text, operations): apt_get_help, 'apt-get install vim'), ('apt saerch vim', invalid_operation('saerch'), apt_help, 'apt search vim'), + ('apt uninstall vim', invalid_operation('uninstall'), + apt_help, 'apt remove vim'), ]) def test_get_new_command(set_help, output, script, help_text, result): set_help(help_text) diff --git a/thefuck/rules/apt_invalid_operation.py b/thefuck/rules/apt_invalid_operation.py index 076109b..c2564c0 100644 --- a/thefuck/rules/apt_invalid_operation.py +++ b/thefuck/rules/apt_invalid_operation.py @@ -53,5 +53,10 @@ def _get_operations(app): @sudo_support def get_new_command(command): invalid_operation = command.output.split()[-1] - operations = _get_operations(command.script_parts[0]) - return replace_command(command, invalid_operation, operations) + + if invalid_operation == 'uninstall': + return [command.script.replace('uninstall', 'remove')] + + else: + operations = _get_operations(command.script_parts[0]) + return replace_command(command, invalid_operation, operations)