Revision 75d1edf8 hbal.hs

b/hbal.hs
44 44
    , optShowHelp  :: Bool           -- ^ Just show the help
45 45
    } deriving Show
46 46

  
47
instance CLI.CLIOptions Options where
48
    showVersion = optShowVer
49
    showHelp    = optShowHelp
50

  
47 51
-- | Default values for the command line options.
48 52
defaultOptions :: Options
49 53
defaultOptions  = Options
......
165 169
main :: IO ()
166 170
main = do
167 171
  cmd_args <- System.getArgs
168
  (opts, args) <- CLI.parseOpts cmd_args "hbal" options
169
                  defaultOptions optShowHelp
172
  (opts, args) <- CLI.parseOpts cmd_args "hbal" options defaultOptions
170 173

  
171 174
  unless (null args) $ do
172 175
         hPutStrLn stderr "Error: this program doesn't take any arguments."
173 176
         exitWith $ ExitFailure 1
174 177

  
175
  when (optShowVer opts) $ do
176
         putStr $ CLI.showVersion "hbal"
177
         exitWith ExitSuccess
178

  
179 178
  (env_node, env_inst) <- CLI.parseEnv ()
180 179
  let nodef = if optNodeSet opts then optNodef opts
181 180
              else env_node

Also available in: Unified diff