From 8ff2336293196a3670444f4829c8bbc2f148834d Mon Sep 17 00:00:00 2001 From: spidermanir Date: Sat, 5 Oct 2019 00:10:23 +0330 Subject: [PATCH 1/3] Change The file --- tests/rules/test_dnf_no_such_command.py | 2 ++ thefuck/rules/dnf_no_such_command.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/rules/test_dnf_no_such_command.py b/tests/rules/test_dnf_no_such_command.py index 6229828..fad9b07 100644 --- a/tests/rules/test_dnf_no_such_command.py +++ b/tests/rules/test_dnf_no_such_command.py @@ -184,6 +184,8 @@ def test_get_operations(set_help): 'dnf install vim'), ('dnf saerch vim', invalid_command('saerch'), 'dnf search vim'), + ('dnf uninstall vim', invalid_command('uninstall'), + 'dnf remove vim'), ]) def test_get_new_command(set_help, output, script, result): set_help(help_text) diff --git a/thefuck/rules/dnf_no_such_command.py b/thefuck/rules/dnf_no_such_command.py index 579f578..8f1f283 100644 --- a/thefuck/rules/dnf_no_such_command.py +++ b/thefuck/rules/dnf_no_such_command.py @@ -30,8 +30,11 @@ def _get_operations(): @sudo_support def get_new_command(command): - misspelled_command = regex.findall(command.output)[0] - return replace_command(command, misspelled_command, _get_operations()) + if misspelled_command == 'uninstall': + return [command.script.replace('uninstall','remove') + else: + misspelled_command = regex.findall(command.output)[0] + return replace_command(command, misspelled_command, _get_operations()) enabled_by_default = dnf_available From 46439e0ee421f05af1a93b93f9a0c118119bf865 Mon Sep 17 00:00:00 2001 From: spidermanir Date: Sat, 5 Oct 2019 00:17:43 +0330 Subject: [PATCH 2/3] sry edit is false --- thefuck/rules/dnf_no_such_command.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/thefuck/rules/dnf_no_such_command.py b/thefuck/rules/dnf_no_such_command.py index 8f1f283..579f578 100644 --- a/thefuck/rules/dnf_no_such_command.py +++ b/thefuck/rules/dnf_no_such_command.py @@ -30,11 +30,8 @@ def _get_operations(): @sudo_support def get_new_command(command): - if misspelled_command == 'uninstall': - return [command.script.replace('uninstall','remove') - else: - misspelled_command = regex.findall(command.output)[0] - return replace_command(command, misspelled_command, _get_operations()) + misspelled_command = regex.findall(command.output)[0] + return replace_command(command, misspelled_command, _get_operations()) enabled_by_default = dnf_available From 66c16038bbfbaa8dfcf3da597d28c8f957e68cf8 Mon Sep 17 00:00:00 2001 From: spidermanir Date: Sat, 5 Oct 2019 01:30:27 +0330 Subject: [PATCH 3/3] Revert "sry edit is false" This reverts commit 46439e0ee421f05af1a93b93f9a0c118119bf865. --- thefuck/rules/dnf_no_such_command.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/thefuck/rules/dnf_no_such_command.py b/thefuck/rules/dnf_no_such_command.py index 579f578..8f1f283 100644 --- a/thefuck/rules/dnf_no_such_command.py +++ b/thefuck/rules/dnf_no_such_command.py @@ -30,8 +30,11 @@ def _get_operations(): @sudo_support def get_new_command(command): - misspelled_command = regex.findall(command.output)[0] - return replace_command(command, misspelled_command, _get_operations()) + if misspelled_command == 'uninstall': + return [command.script.replace('uninstall','remove') + else: + misspelled_command = regex.findall(command.output)[0] + return replace_command(command, misspelled_command, _get_operations()) enabled_by_default = dnf_available