Revision 525bfb36 htools/Ganeti/HTools/CLI.hs

b/htools/Ganeti/HTools/CLI.hs
1 1
{-| Implementation of command-line functions.
2 2

  
3
This module holds the common cli-related functions for the binaries,
4
separated into this module since Utils.hs is used in many other places
5
and this is more IO oriented.
3
This module holds the common command-line related functions for the
4
binaries, separated into this module since "Ganeti.HTools.Utils" is
5
used in many other places and this is more IO oriented.
6 6

  
7 7
-}
8 8

  
......
89 89
import Ganeti.HTools.Types
90 90
import Ganeti.HTools.Utils
91 91

  
92
-- | The default value for the luxi socket
92
-- * Constants
93

  
94
-- | The default value for the luxi socket.
95
--
96
-- This is re-exported from the "Ganeti.Constants" module.
93 97
defaultLuxiSocket :: FilePath
94 98
defaultLuxiSocket = C.masterSocket
95 99

  
100
-- * Data types
101

  
96 102
-- | Command line options structure.
97 103
data Options = Options
98 104
    { optDataFile    :: Maybe FilePath -- ^ Path to the cluster data file
......
170 176
 , optVerbose     = 1
171 177
 }
172 178

  
173
-- | Abrreviation for the option type
179
-- | Abrreviation for the option type.
174 180
type OptType = OptDescr (Options -> Result Options)
175 181

  
182
-- * Command line options
183

  
176 184
oDataFile :: OptType
177 185
oDataFile = Option "t" ["text-data"]
178 186
            (ReqArg (\ f o -> Ok o { optDataFile = Just f }) "FILE")
......
394 402
           (NoArg (\ opts -> Ok opts { optVerbose = optVerbose opts + 1 }))
395 403
           "increase the verbosity level"
396 404

  
397
-- | Usage info
405
-- * Functions
406

  
407
-- | Usage info.
398 408
usageHelp :: String -> [OptType] -> String
399 409
usageHelp progname =
400 410
    usageInfo (printf "%s %s\nUsage: %s [OPTION...]"
401 411
               progname Version.version progname)
402 412

  
403
-- | Command line parser, using the 'options' structure.
413
-- | Command line parser, using the 'Options' structure.
404 414
parseOpts :: [String]               -- ^ The command line arguments
405 415
          -> String                 -- ^ The program name
406 416
          -> [OptType]              -- ^ The supported command line options

Also available in: Unified diff