2015-07-04 14:17:33 +02:00
|
|
|
import re
|
2015-08-27 16:42:09 +03:00
|
|
|
from thefuck.utils import replace_command, for_app
|
2015-07-04 14:17:33 +02:00
|
|
|
|
|
|
|
|
2015-08-27 16:42:09 +03:00
|
|
|
@for_app('tmux')
|
2015-09-07 13:00:29 +03:00
|
|
|
def match(command):
|
2017-08-31 17:58:56 +02:00
|
|
|
return ('ambiguous command:' in command.output
|
|
|
|
and 'could be:' in command.output)
|
2015-07-04 14:17:33 +02:00
|
|
|
|
|
|
|
|
2015-09-07 13:00:29 +03:00
|
|
|
def get_new_command(command):
|
2015-07-10 09:49:49 +02:00
|
|
|
cmd = re.match(r"ambiguous command: (.*), could be: (.*)",
|
2017-08-31 17:58:56 +02:00
|
|
|
command.output)
|
2015-07-04 14:17:33 +02:00
|
|
|
|
2015-07-10 09:49:49 +02:00
|
|
|
old_cmd = cmd.group(1)
|
2015-11-22 11:38:59 -02:00
|
|
|
suggestions = [c.strip() for c in cmd.group(2).split(',')]
|
2015-07-10 09:49:49 +02:00
|
|
|
|
2015-07-31 21:48:14 +02:00
|
|
|
return replace_command(command, old_cmd, suggestions)
|