Merge 022014298a into 62e0767c50
This commit is contained in:
commit
609ed1cb3c
|
|
@ -0,0 +1,34 @@
|
|||
#
|
||||
# $ terraform destory
|
||||
#
|
||||
# Terraform has no command named "destory". Did you mean "destroy"?
|
||||
#
|
||||
# $ fuck
|
||||
# terraform destroy [enter/↑/↓/ctrl+c]
|
||||
#
|
||||
import re
|
||||
from thefuck.utils import for_app
|
||||
|
||||
REGEX = (
|
||||
r"Terraform has no command named \".+?\"\. "
|
||||
r"Did you mean \"(?P<suggestion>.+)\"\?"
|
||||
)
|
||||
|
||||
|
||||
@for_app("terraform")
|
||||
def match(command) -> bool:
|
||||
return (
|
||||
"Terraform has no command named" in command.output
|
||||
and "Did you mean" in command.output
|
||||
)
|
||||
|
||||
|
||||
def get_new_command(command) -> str:
|
||||
matches = re.search(REGEX, command.output)
|
||||
if matches:
|
||||
return f"""terraform {matches.groupdict().get("suggestion", "")}"""
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
||||
enabled_by_default = True
|
||||
Loading…
Reference in New Issue