Fix heroku_not_command for new stderr format
heroku updated its command suggestion formatting, so account for that.
For example:
$ heroku log
▸ log is not a heroku command.
▸ Perhaps you meant logs?
▸ Run heroku _ to run heroku logs.
▸ Run heroku help for a list of available commands.
$ fuck
heroku logs [enter/↑/↓/ctrl+c]
This commit is contained in:
committed by
Vladimir Iakovlev
parent
c3eca8234a
commit
d41cbb6810
@@ -1,19 +1,11 @@
|
||||
import re
|
||||
from thefuck.utils import replace_command, for_app
|
||||
from thefuck.utils import for_app
|
||||
|
||||
|
||||
@for_app('heroku')
|
||||
def match(command):
|
||||
return 'is not a heroku command' in command.stderr and \
|
||||
'Perhaps you meant' in command.stderr
|
||||
|
||||
|
||||
def _get_suggests(stderr):
|
||||
for line in stderr.split('\n'):
|
||||
if 'Perhaps you meant' in line:
|
||||
return re.findall(r'`([^`]+)`', line)
|
||||
return 'Run heroku _ to run' in command.stderr
|
||||
|
||||
|
||||
def get_new_command(command):
|
||||
wrong = re.findall(r'`(\w+)` is not a heroku command', command.stderr)[0]
|
||||
return replace_command(command, wrong, _get_suggests(command.stderr))
|
||||
return re.findall('Run heroku _ to run ([^.]*)', command.stderr)[0]
|
||||
|
||||
Reference in New Issue
Block a user