Improve output of `hubot pager schedules`

In a similar fashion to other commits, make the links easier to scan,
use nice bullet points, and chunk the results to avoid truncation.
This commit is contained in:
Andrew Hayworth 2018-10-10 11:28:09 -05:00
Родитель 7eece8d441
Коммит 8eee6c7c71
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -376,13 +376,15 @@ module.exports = (robot) ->
return
renderSchedule = (schedule, cb) ->
cb(null, "* #{schedule.name} - https://#{pagerduty.subdomain}.pagerduty.com/schedules##{schedule.id}")
cb(null, "• <https://#{pagerduty.subdomain}.pagerduty.com/schedules##{schedule.id}|#{schedule.name}>")
async.map schedules, renderSchedule, (err, results) ->
if err?
robot.emit 'error', err, msg
return
msg.send results.join("\n")
for chunk in chunkMessageLines(results, 7000)
msg.send chunk.join("\n")
# hubot pager schedule <schedule> - show <schedule>'s shifts for the upcoming month
# hubot pager overrides <schedule> - show upcoming overrides for the next month