Skip to content
Snippets Groups Projects
  • Iustin Pop's avatar
    Change type of program options to 'IO [Options]' · d66aa238
    Iustin Pop authored
    
    Some options have defaults that depend on the environment, and we
    could handle these in two ways:
    
    - use a place-holder value (e.g. data X a = Default | Custom a) that
      is later read from the environment
    - move the options list to IO monad, where it can read the
      environment, etc.
    
    The second option allows also displaying the actual defaults in the
    `--help' output, even though it's not as nice, so I went with it.
    
    This patch only changes the option types, without actually changing
    any options yet.
    
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
    d66aa238
Program.hs 1.84 KiB
{-| Small module holding program definitions.

-}

{-

Copyright (C) 2011, 2012 Google Inc.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.

-}

module Ganeti.HTools.Program
  ( personalities
  ) where

import Ganeti.Common (ArgCompletion)
import Ganeti.HTools.CLI (OptType, Options)

import qualified Ganeti.HTools.Program.Hail as Hail
import qualified Ganeti.HTools.Program.Hbal as Hbal
import qualified Ganeti.HTools.Program.Hcheck as Hcheck
import qualified Ganeti.HTools.Program.Hscan as Hscan
import qualified Ganeti.HTools.Program.Hspace as Hspace
import qualified Ganeti.HTools.Program.Hinfo as Hinfo

-- | Supported binaries.
personalities :: [(String,
                   (Options -> [String] -> IO (), IO [OptType],
                    [ArgCompletion]))]
personalities = [ ("hail",   (Hail.main,   Hail.options,   Hail.arguments))
                , ("hbal",   (Hbal.main,   Hbal.options,   Hbal.arguments))
                , ("hcheck", (Hcheck.main, Hcheck.options, Hcheck.arguments))
                , ("hscan",  (Hscan.main,  Hscan.options,  Hscan.arguments ))
                , ("hspace", (Hspace.main, Hspace.options, Hspace.arguments))
                , ("hinfo",  (Hinfo.main,  Hinfo.options,  Hinfo.arguments))
                ]