Skip to content

Commit 6259811

Browse files
committed
(#649) Enhance the rendering of the table
1 parent 48e6817 commit 6259811

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/Bot/Help.hs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,25 @@ refreshHelpGistId =
7474

7575
gistRenderCommandTable :: CommandTable -> T.Text
7676
gistRenderCommandTable =
77-
("* Builtin Commands \n" <>) . T.unlines . map renderRow . M.toList
77+
([qms|* Builtin Commands\n{header}\n|-\n|] <>) .
78+
T.unlines . map renderRow . M.toList
7879
where
80+
header :: T.Text
81+
header = "|Name|Description|Location|"
82+
renderRow :: (T.Text, BuiltinCommand) -> T.Text
7983
renderRow (name, command) =
80-
[qms||{name}|{bcDescription command}|{bcGitHubLocation command}||]
84+
[qms||{name}|{bcDescription command}|{location}||]
85+
where
86+
location :: T.Text
87+
location = [qms|[[{bcGitHubLocation command}][Source↗]]|]
8188

8289
gistRenderCustomCommandsTable :: [Entity CustomCommand] -> T.Text
8390
gistRenderCustomCommandsTable =
84-
("* Custom commands \n" <>) . T.unlines . map (renderRow . entityPayload)
91+
([qms|* Custom commands\n{header}\n|-\n|] <>) .
92+
T.unlines . map (renderRow . entityPayload)
8593
where
94+
header :: T.Text
95+
header = "|Name|Definition|%times|"
8696
renderRow (CustomCommand name message times) =
8797
[qms||{name}|{message}|{times}||]
8898

0 commit comments

Comments
 (0)