Revision 7ce2f8ee src/Ganeti/Common.hs

b/src/Ganeti/Common.hs
117 117
      stripped = stripPrefix "OptCompl" show_compl
118 118
  in map toLower $ fromMaybe show_compl stripped
119 119

  
120
-- | Tex serialisation for 'ArgCompletion'.
120
-- | Text serialisation for 'ArgCompletion'.
121 121
argComplToText :: ArgCompletion -> String
122 122
argComplToText (ArgCompletion optc min_cnt max_cnt) =
123 123
  complToText optc ++ " " ++ show min_cnt ++ " " ++ maybe "none" show max_cnt
......
236 236
-- | Generates completion information for a multi-command binary.
237 237
multiCmdCompletion :: (StandardOptions a) => PersonalityList a -> String
238 238
multiCmdCompletion personalities =
239
  unlines .
240
  map argComplToText $
241
  map (\(cmd, _) -> ArgCompletion (OptComplChoices [cmd]) 1 (Just 1))
242
    personalities
239
  argComplToText $
240
    ArgCompletion (OptComplChoices (map fst personalities))
241
      1 (Just 1)
243 242

  
244 243
-- | Displays completion information for a multi-command binary and exits.
245 244
showCmdCompletion :: (StandardOptions a) => PersonalityList a -> IO b
246 245
showCmdCompletion personalities =
247
  putStr (multiCmdCompletion personalities) >> exitSuccess
246
  putStrLn (multiCmdCompletion personalities) >> exitSuccess
248 247

  
249 248
-- | Command line parser, using a generic 'Options' structure.
250 249
parseOpts :: (StandardOptions a) =>

Also available in: Unified diff