Revision 8032b3b5 Ganeti/HTools/CLI.hs
b/Ganeti/HTools/CLI.hs | ||
---|---|---|
9 | 9 |
module Ganeti.HTools.CLI |
10 | 10 |
( |
11 | 11 |
parseOpts |
12 |
, parseEnv |
|
12 | 13 |
, showVersion |
13 | 14 |
, shTemplate |
14 | 15 |
) where |
15 | 16 |
|
16 | 17 |
import System.Console.GetOpt |
18 |
import System.Posix.Env |
|
17 | 19 |
import System.IO |
18 | 20 |
import System.Info |
19 | 21 |
import System |
... | ... | |
46 | 48 |
where header = printf "%s %s\nUsage: %s [OPTION...]" |
47 | 49 |
progname Version.version progname |
48 | 50 |
|
51 |
-- | Parse the environment and return the node/instance names. |
|
52 |
-- This also hardcodes here the default node/instance file names. |
|
53 |
parseEnv :: () -> IO (String, String) |
|
54 |
parseEnv () = do |
|
55 |
a <- getEnvDefault "HTOOLS_NODES" "nodes" |
|
56 |
b <- getEnvDefault "HTOOLS_INSTANCES" "instances" |
|
57 |
return (a, b) |
|
49 | 58 |
|
50 | 59 |
-- | Return a version string for the program |
51 | 60 |
showVersion :: String -- ^ The program name |
Also available in: Unified diff