remove magic numbers
This commit is contained in:
parent
a89a6f2114
commit
c274aadabc
1 changed files with 5 additions and 2 deletions
|
@ -57,9 +57,12 @@ usage header cmds options =
|
|||
cmddescs = unlines $ map (indent . showcmd) cmds
|
||||
showcmd c =
|
||||
cmdname c ++
|
||||
pad 11 (cmdname c) ++
|
||||
pad (commandlen + 1) (cmdname c) ++
|
||||
cmdparams c ++
|
||||
pad 13 (cmdparams c) ++
|
||||
pad (commandparamlen + 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
|
||||
|
|
Loading…
Reference in a new issue