summaryrefslogtreecommitdiff
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-12-30 15:15:22 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-12-30 15:15:22 -0400
commit1c451fe3628f535898e7cf87ccad30270c6d16fb (patch)
treecacdaf58092b9dd0d8c8c47ba96c20484dc99dab /CmdLine.hs
parentc274aadabcd1737e03003834dcf1f6bd9a79b0aa (diff)
tweak
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs8
1 files changed, 3 insertions, 5 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 3767fc240..a2645f75f 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -57,12 +57,10 @@ usage header cmds options =
cmddescs = unlines $ map (indent . showcmd) cmds
showcmd c =
cmdname c ++
- pad (commandlen + 1) (cmdname c) ++
+ pad (longest cmdname + 1) (cmdname c) ++
cmdparams c ++
- pad (commandparamlen + 2) (cmdparams c) ++
+ pad (longest cmdparams + 2) (cmdparams c) ++
cmddesc c
indent l = " " ++ l
pad n s = replicate (n - length s) ' '
- longest l = foldl max 0 $ map length l
- commandlen = longest $ map cmdname cmds
- commandparamlen = longest $ map cmdparams cmds
+ longest f = foldl max 0 $ map (length . f) cmds