module Ganeti.HTools.CLI
(
parseOpts
+ , parseEnv
, showVersion
, shTemplate
) where
import System.Console.GetOpt
+import System.Posix.Env
import System.IO
import System.Info
import System
where header = printf "%s %s\nUsage: %s [OPTION...]"
progname Version.version progname
+-- | Parse the environment and return the node/instance names.
+-- This also hardcodes here the default node/instance file names.
+parseEnv :: () -> IO (String, String)
+parseEnv () = do
+ a <- getEnvDefault "HTOOLS_NODES" "nodes"
+ b <- getEnvDefault "HTOOLS_INSTANCES" "instances"
+ return (a, b)
-- | Return a version string for the program
showVersion :: String -- ^ The program name