Revision 559c4a98 htools/Ganeti/Common.hs
b/htools/Ganeti/Common.hs | ||
---|---|---|
96 | 96 |
type Personality a = ( a -> [String] -> IO () -- The main function |
97 | 97 |
, IO [GenericOptType a] -- The options |
98 | 98 |
, [ArgCompletion] -- The description of args |
99 |
, String -- Description |
|
99 | 100 |
) |
100 | 101 |
|
101 | 102 |
-- | Personality lists type, common across all binaries that expose |
... | ... | |
209 | 210 |
, "" |
210 | 211 |
, "Commands:" |
211 | 212 |
] |
212 |
rows = map (\(cmd, _) -> |
|
213 |
printf " %-*s" mlen cmd::String) sorted |
|
213 |
rows = map (\(cmd, (_, _, _, desc)) -> |
|
214 |
-- FIXME: not wrapped here |
|
215 |
printf " %-*s - %s" mlen cmd desc::String) sorted |
|
214 | 216 |
in unlines $ header ++ rows |
215 | 217 |
|
216 | 218 |
-- | Displays usage for a program and exits. |
... | ... | |
266 | 268 |
[] -> usage False |
267 | 269 |
case cmd `lookup` personalities of |
268 | 270 |
Nothing -> usage False |
269 |
Just (mainfn, optdefs, argdefs) -> do |
|
271 |
Just (mainfn, optdefs, argdefs, _) -> do
|
|
270 | 272 |
optdefs' <- optdefs |
271 | 273 |
(opts, args) <- parseOpts defaults cmd_args progname |
272 | 274 |
(optdefs' ++ genopts) argdefs |
Also available in: Unified diff