2015-04-18 23:19:34 +02:00
|
|
|
import re
|
2015-08-27 16:42:09 +03:00
|
|
|
from thefuck.utils import replace_command, get_all_matched_commands, for_app
|
2015-08-25 14:09:47 +03:00
|
|
|
from thefuck.specific.sudo import sudo_support
|
2015-04-18 23:19:34 +02:00
|
|
|
|
|
|
|
|
2015-04-22 16:45:38 +02:00
|
|
|
@sudo_support
|
2015-08-27 16:42:09 +03:00
|
|
|
@for_app('lein')
|
2015-04-18 23:19:34 +02:00
|
|
|
def match(command, settings):
|
|
|
|
return (command.script.startswith('lein')
|
|
|
|
and "is not a task. See 'lein help'" in command.stderr
|
|
|
|
and 'Did you mean this?' in command.stderr)
|
|
|
|
|
|
|
|
|
2015-04-22 16:45:38 +02:00
|
|
|
@sudo_support
|
2015-04-18 23:19:34 +02:00
|
|
|
def get_new_command(command, settings):
|
|
|
|
broken_cmd = re.findall(r"'([^']*)' is not a task",
|
|
|
|
command.stderr)[0]
|
2015-07-29 16:09:26 +03:00
|
|
|
new_cmds = get_all_matched_commands(command.stderr, 'Did you mean this?')
|
|
|
|
return replace_command(command, broken_cmd, new_cmds)
|