Revision 9188aeef Ganeti/HTools/CLI.hs

b/Ganeti/HTools/CLI.hs
33 33

  
34 34
import Ganeti.HTools.Types
35 35

  
36
-- | Class for types which support show help and show version
36
-- | Class for types which support show help and show version.
37 37
class CLIOptions a where
38
    -- | Denotes whether the show help option has been passed.
38 39
    showHelp    :: a -> Bool
40
    -- | Denotes whether the show version option has been passed.
39 41
    showVersion :: a -> Bool
40 42

  
41
-- | Class for types which support the -i/-n/-m options
43
-- | Class for types which support the -i\/-n\/-m options.
42 44
class EToolOptions a where
45
    -- | Returns the node file name.
43 46
    nodeFile   :: a -> FilePath
47
    -- | Tells whether the node file has been passed as an option.
44 48
    nodeSet    :: a -> Bool
49
    -- | Returns the instance file name.
45 50
    instFile   :: a -> FilePath
51
    -- | Tells whether the instance file has been passed as an option.
46 52
    instSet    :: a -> Bool
53
    -- | Rapi target, if one has been passed.
47 54
    masterName :: a -> String
55
    -- | Whether to be less verbose.
48 56
    silent     :: a -> Bool
49 57

  
50 58
-- | Command line parser, using the 'options' structure.
......
75 83
      where header = printf "%s %s\nUsage: %s [OPTION...]"
76 84
                     progname Version.version progname
77 85

  
78
-- | Parse the environment and return the node/instance names.
79
-- This also hardcodes here the default node/instance file names.
86
-- | Parse the environment and return the node\/instance names.
87
--
88
-- This also hardcodes here the default node\/instance file names.
80 89
parseEnv :: () -> IO (String, String)
81 90
parseEnv () = do
82 91
  a <- getEnvDefault "HTOOLS_NODES" "nodes"
83 92
  b <- getEnvDefault "HTOOLS_INSTANCES" "instances"
84 93
  return (a, b)
85 94

  
86
-- | A shell script template for autogenerated scripts
95
-- | A shell script template for autogenerated scripts.
87 96
shTemplate :: String
88 97
shTemplate =
89 98
    printf "#!/bin/sh\n\n\
......
97 106
           \  fi\n\
98 107
           \}\n\n"
99 108

  
100
-- | External tool data loader from a variety of sources
109
-- | External tool data loader from a variety of sources.
101 110
loadExternalData :: (EToolOptions a) =>
102 111
                    a
103 112
                 -> IO (Node.List, Instance.List, String)

Also available in: Unified diff