Revision e60fa4af htools/Ganeti/HTools/CLI.hs

b/htools/Ganeti/HTools/CLI.hs
567 567
    hPutStrLn stderr . unlines . map (printf "  - %s") $ fix_msgs
568 568

  
569 569
-- | Format a list of key, value as a shell fragment.
570
printKeys :: String -> [(String, String)] -> IO ()
570
printKeys :: String              -- ^ Prefix to printed variables
571
          -> [(String, String)]  -- ^ List of (key, value) pairs to be printed
572
          -> IO ()
571 573
printKeys prefix = mapM_ (\(k, v) ->
572 574
                       printf "%s_%s=%s\n" prefix (map toUpper k) (ensureQuoted v))
573 575

  
574 576
-- | Prints the final @OK@ marker in machine readable output.
575
printFinal :: String -> Bool -> IO ()
577
printFinal :: String    -- ^ Prefix to printed variable
578
           -> Bool      -- ^ Whether output should be machine readable
579
                        -- Note: if not, there is nothing to print
580
           -> IO ()
576 581
printFinal prefix True =
577 582
  -- this should be the final entry
578 583
  printKeys prefix [("OK", "1")]

Also available in: Unified diff