#N/A: Add conda rule (#1138)

* add conda rules

* revert

* add conda

* add to readme and flake

* consistency with quotes and use for_app

* Update thefuck/rules/conda_mistype.py

Co-authored-by: Pablo Aguiar <scorphus@gmail.com>
This commit is contained in:
Connor Martin
2021-02-08 06:04:59 -06:00
committed by GitHub
parent 0c58317932
commit fd90e69ceb
3 changed files with 42 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
import re
from thefuck.utils import replace_command, for_app
@for_app("conda")
def match(command):
"""
Match a mistyped command
"""
return "Did you mean 'conda" in command.output
def get_new_command(command):
match = re.findall(r"'conda ([^']*)'", command.output)
broken_cmd = match[0]
correct_cmd = match[1]
return replace_command(command, broken_cmd, [correct_cmd])