From 244a523da1da781f0cffc2c2218cf4e2fcab2ace Mon Sep 17 00:00:00 2001 From: Dragory Date: Sun, 17 Feb 2019 22:51:04 +0200 Subject: [PATCH] Utility: pad IDs in !roles to take the same space --- src/plugins/Utility.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/Utility.ts b/src/plugins/Utility.ts index df046d3e..d2350990 100644 --- a/src/plugins/Utility.ts +++ b/src/plugins/Utility.ts @@ -142,10 +142,13 @@ export class UtilityPlugin extends ZeppelinPlugin { }); } + const longestId = roles.reduce((longest, role) => Math.max(longest, role.id.length), 0); + const chunks = chunkArray(roles, 20); for (const [i, chunk] of chunks.entries()) { const roleLines = chunk.map(role => { - let line = `${role.id} ${role.name}`; + const paddedId = role.id.padEnd(longestId, " "); + let line = `${paddedId} ${role.name}`; if (role._memberCount != null) { line += role._memberCount === 1 ? ` (${role._memberCount} member)` : ` (${role._memberCount} members)`; }