mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-29 14:08:44 +00:00
19 lines
530 B
Python
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)
|