mirror of
https://github.com/nvbn/thefuck.git
synced 2025-03-15 07:08:49 +00:00
19 lines
502 B
Python
19 lines
502 B
Python
import re
|
|
from thefuck.utils import replace_command, for_app
|
|
|
|
|
|
@for_app('tmux')
|
|
def match(command, settings):
|
|
return ('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)
|