mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-26 12:38:52 +00:00
14 lines
510 B
Python
14 lines
510 B
Python
import re
|
|
from thefuck.utils import (replace_command, get_all_matched_commands)
|
|
|
|
def match(command, settings):
|
|
return (re.search(r"([^:]*): Unknown command.*", command.stderr) != None
|
|
and re.search(r"Did you mean ([^?]*)?", command.stderr) != None)
|
|
|
|
|
|
def get_new_command(command, settings):
|
|
broken_cmd = re.findall(r"([^:]*): Unknown command.*", command.stderr)[0]
|
|
matched = re.findall(r"Did you mean ([^?]*)?", command.stderr)
|
|
return replace_command(command, broken_cmd, matched)
|
|
|