Revision 7c3a6391 src/Ganeti/HTools/CLI.hs
b/src/Ganeti/HTools/CLI.hs | ||
---|---|---|
36 | 36 |
, parseYesNo |
37 | 37 |
, parseISpecString |
38 | 38 |
, shTemplate |
39 |
, maybeSaveCommands |
|
39 | 40 |
, maybePrintNodes |
40 | 41 |
, maybePrintInsts |
41 | 42 |
, maybeShowWarnings |
... | ... | |
720 | 721 |
\ fi\n\ |
721 | 722 |
\}\n\n" |
722 | 723 |
|
724 |
-- | Optionally show or save a list of commands |
|
725 |
maybeSaveCommands :: String -- ^ Informal description |
|
726 |
-> Options |
|
727 |
-> String -- ^ commands |
|
728 |
-> IO () |
|
729 |
maybeSaveCommands msg opts cmds = |
|
730 |
case optShowCmds opts of |
|
731 |
Nothing -> return () |
|
732 |
Just "-" -> do |
|
733 |
putStrLn "" |
|
734 |
putStrLn msg |
|
735 |
putStr . unlines . map (" " ++) . filter (/= " check") . lines $ cmds |
|
736 |
Just out_path -> do |
|
737 |
writeFile out_path (shTemplate ++ cmds) |
|
738 |
printf "The commands have been written to file '%s'\n" out_path |
|
739 |
|
|
723 | 740 |
-- | Optionally print the node list. |
724 | 741 |
maybePrintNodes :: Maybe [String] -- ^ The field list |
725 | 742 |
-> String -- ^ Informational message |
Also available in: Unified diff