tweak
This commit is contained in:
parent
c274aadabc
commit
1c451fe362
1 changed files with 3 additions and 5 deletions
|
@ -57,12 +57,10 @@ usage header cmds options =
|
||||||
cmddescs = unlines $ map (indent . showcmd) cmds
|
cmddescs = unlines $ map (indent . showcmd) cmds
|
||||||
showcmd c =
|
showcmd c =
|
||||||
cmdname c ++
|
cmdname c ++
|
||||||
pad (commandlen + 1) (cmdname c) ++
|
pad (longest cmdname + 1) (cmdname c) ++
|
||||||
cmdparams c ++
|
cmdparams c ++
|
||||||
pad (commandparamlen + 2) (cmdparams c) ++
|
pad (longest cmdparams + 2) (cmdparams c) ++
|
||||||
cmddesc c
|
cmddesc c
|
||||||
indent l = " " ++ l
|
indent l = " " ++ l
|
||||||
pad n s = replicate (n - length s) ' '
|
pad n s = replicate (n - length s) ' '
|
||||||
longest l = foldl max 0 $ map length l
|
longest f = foldl max 0 $ map (length . f) cmds
|
||||||
commandlen = longest $ map cmdname cmds
|
|
||||||
commandparamlen = longest $ map cmdparams cmds
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue