diff options
author | Teddy Wing | 2017-08-20 02:07:21 +0200 |
---|---|---|
committer | Teddy Wing | 2017-08-20 02:12:10 +0200 |
commit | 7ec97cd79face496f739265dcf1841f04ce1c519 (patch) | |
tree | 3d998229bd617f08d56addaf5cbf82962aef8ae7 /src/Plugin/Help.hs | |
parent | 473b9098763000f6b1e5c531f2bd6c8b2f8a40c1 (diff) | |
download | sorbot-7ec97cd79face496f739265dcf1841f04ce1c519.tar.bz2 |
Reformat Help output
Instead of printing all help text on a single line as a result of
joining the list of help text, print each plugin's help on a separate
line.
Also separate commands from descriptions with a dash instead of a tab as
the tab character was getting rendered as an `I` in irssi instead of the
actual whitespace I had been hoping for. The dash in inspired by Hubot.
In order to print multiple lines of output, we needed to change the IRC
PRIVMSG handler. This now splits the plugin result at newlines into a
list and sends separate PRIVMSGs for each line of output. Before, text
with newlines would only show the first line in the resulting IRC
message.
Assume plugin error messages will always be a single line.
Diffstat (limited to 'src/Plugin/Help.hs')
-rw-r--r-- | src/Plugin/Help.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Plugin/Help.hs b/src/Plugin/Help.hs index 57e106d..470dd33 100644 --- a/src/Plugin/Help.hs +++ b/src/Plugin/Help.hs @@ -18,8 +18,8 @@ help = Plugin helpAction :: PluginAction helpAction _ = do - return $ Right $ T.concat - [command p `T.append` "\t" `T.append` description p | p <- plugins] + return $ Right $ T.intercalate "\n" + [command p `T.append` " – " `T.append` description p | p <- plugins] plugins :: [Plugin] plugins = PL.plugins ++ [help] |