Revision f5af3409

b/htools/Ganeti/Common.hs
29 29
module Ganeti.Common
30 30
  ( GenericOptType
31 31
  , StandardOptions(..)
32
  , OptCompletion(..)
33
  , optComplYesNo
32 34
  , oShowHelp
33 35
  , oShowVer
34 36
  , usageHelp
......
50 52
import Ganeti.BasicTypes
51 53
import qualified Ganeti.Version as Version (version)
52 54

  
55
-- | Parameter type.
56
data OptCompletion = OptComplNone             -- ^ No parameter to this option
57
                   | OptComplFile             -- ^ An existing file
58
                   | OptComplDir              -- ^ An existing directory
59
                   | OptComplHost             -- ^ Host name
60
                   | OptComplInetAddr         -- ^ One ipv4\/ipv6 address
61
                   | OptComplOneNode          -- ^ One node
62
                   | OptComplManyNodes        -- ^ Many nodes, comma-sep
63
                   | OptComplOneInstance      -- ^ One instance
64
                   | OptComplManyInstances    -- ^ Many instances, comma-sep
65
                   | OptComplOneOs            -- ^ One OS name
66
                   | OptComplOneIallocator    -- ^ One iallocator
67
                   | OptComplInstAddNodes     -- ^ Either one or two nodes
68
                   | OptComplOneGroup         -- ^ One group
69
                   | OptComplNumeric          -- ^ Float values
70
                   | OptComplString           -- ^ Arbitrary string
71
                   | OptComplChoices [String] -- ^ List of string choices
72
                   deriving (Show, Read, Eq)
73

  
74
-- | Yes\/no choices completion.
75
optComplYesNo :: OptCompletion
76
optComplYesNo = OptComplChoices ["yes", "no"]
77

  
53 78
-- | Abrreviation for the option type.
54 79
type GenericOptType a = OptDescr (a -> Result a)
55 80

  

Also available in: Unified diff