diff options
author | Teddy Wing | 2017-08-20 02:33:22 +0200 |
---|---|---|
committer | Teddy Wing | 2017-08-20 02:33:22 +0200 |
commit | be5726ab7b5b48ea7b29a50aaf54189ebe1ff282 (patch) | |
tree | eaeb57746f511e38088d373503724148761ed074 /src | |
parent | 08077a854a63884de619034d6762aa5b18ed2f91 (diff) | |
download | sorbot-be5726ab7b5b48ea7b29a50aaf54189ebe1ff282.tar.bz2 |
Help: Right-align command names
To aid the readability of the help output, align the dashes vertically
so the descriptions are in a uniform place.
The resulting output now looks like this:
<git_sha> – Generate a commit URL based on the given SHA.
git remote set origin URL – Set the git remote URL for this channel.
help – Show a list of available bot commands.
Diffstat (limited to 'src')
-rw-r--r-- | src/Plugin/Help.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Plugin/Help.hs b/src/Plugin/Help.hs index 470dd33..a141745 100644 --- a/src/Plugin/Help.hs +++ b/src/Plugin/Help.hs @@ -19,7 +19,12 @@ help = Plugin helpAction :: PluginAction helpAction _ = do return $ Right $ T.intercalate "\n" - [command p `T.append` " – " `T.append` description p | p <- plugins] + [T.justifyRight longestCommandLen ' ' (command p) + `T.append` " – " + `T.append` description p + | p <- plugins] + where + longestCommandLen = foldr (max) 0 (map (T.length . command) plugins) plugins :: [Plugin] plugins = PL.plugins ++ [help] |