1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-29 14:08:44 +00:00
2015-07-31 22:19:16 +02:00

19 lines
530 B
Python

from thefuck.utils import get_closest, replace_command
import re
def match(command, settings):
return ('tmux' in command.script
and 'ambiguous command:' in command.stderr
and 'could be:' in command.stderr)
def get_new_command(command, settings):
cmd = re.match(r"ambiguous command: (.*), could be: (.*)",
command.stderr)
old_cmd = cmd.group(1)
suggestions = [cmd.strip() for cmd in cmd.group(2).split(',')]
return replace_command(command, old_cmd, suggestions)