Commit ecebe9f6 authored by Iustin Pop's avatar Iustin Pop
Browse files

Split the OptComplNumeric into integer/float ones



This allows the command completion to treat them as separate option
types; this is not useful in build-bash-completion right now, but
might become so in the future.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent f8d01158
......@@ -644,9 +644,10 @@ def HaskellOptToOptParse(opts, kind):
return cli.cli_option(*opts, action="store_true")
elif kind in ["file", "string", "host", "dir", "inetaddr"]:
return cli.cli_option(*opts, type="string")
elif kind == "numeric":
# FIXME: float values here
return cli.cli_option(*opts, type="string")
elif kind == "integer":
return cli.cli_option(*opts, type="int")
elif kind == "float":
return cli.cli_option(*opts, type="float")
elif kind == "onegroup":
return cli.cli_option(*opts, type="string",
completion_suggest=cli.OPT_COMPL_ONE_NODEGROUP)
......
......@@ -71,7 +71,8 @@ data OptCompletion = OptComplNone -- ^ No parameter to this option
| OptComplOneIallocator -- ^ One iallocator
| OptComplInstAddNodes -- ^ Either one or two nodes
| OptComplOneGroup -- ^ One group
| OptComplNumeric -- ^ Float values
| OptComplInteger -- ^ Integer values
| OptComplFloat -- ^ Float values
| OptComplJobId -- ^ Job Id
| OptComplCommand -- ^ Command (executable)
| OptComplString -- ^ Arbitrary string
......
......@@ -144,7 +144,7 @@ oPort def =
(reqWithConversion (tryRead "reading port")
(\port opts -> Ok opts { optPort = Just port }) "PORT")
("Network port (default: " ++ show def ++ ")"),
OptComplNumeric)
OptComplInteger)
oBindAddress :: OptType
oBindAddress =
......
......@@ -256,7 +256,7 @@ oSpindleUse =
return $ opts { optSpindleUse = Just su })
"SPINDLES") "select how many virtual spindle instances use\
\ [default read from cluster]",
OptComplNumeric)
OptComplFloat)
oSelInst :: OptType
oSelInst =
......@@ -354,7 +354,7 @@ oMaxCpu =
return $ opts { optMcpu = Just mcpu }) "RATIO")
"maximum virtual-to-physical cpu ratio for nodes (from 0\
\ upwards) [default read from cluster]",
OptComplNumeric)
OptComplFloat)
oMaxSolLength :: OptType
oMaxSolLength =
......@@ -364,7 +364,7 @@ oMaxSolLength =
"cap the solution at this many balancing or allocation \
\ rounds (useful for very unbalanced clusters or empty \
\ clusters)",
OptComplNumeric)
OptComplInteger)
oMinDisk :: OptType
oMinDisk =
......@@ -372,7 +372,7 @@ oMinDisk =
(reqWithConversion (tryRead "min free disk space")
(\n opts -> Ok opts { optMdsk = n }) "RATIO")
"minimum free disk space for nodes (between 0 and 1) [0]",
OptComplNumeric)
OptComplFloat)
oMinGain :: OptType
oMinGain =
......@@ -380,7 +380,7 @@ oMinGain =
(reqWithConversion (tryRead "min gain")
(\g opts -> Ok opts { optMinGain = g }) "DELTA")
"minimum gain to aim for in a balancing step before giving up",
OptComplNumeric)
OptComplFloat)
oMinGainLim :: OptType
oMinGainLim =
......@@ -388,7 +388,7 @@ oMinGainLim =
(reqWithConversion (tryRead "min gain limit")
(\g opts -> Ok opts { optMinGainLim = g }) "SCORE")
"minimum cluster score for which we start checking the min-gain",
OptComplNumeric)
OptComplFloat)
oMinScore :: OptType
oMinScore =
......@@ -396,7 +396,7 @@ oMinScore =
(reqWithConversion (tryRead "min score")
(\e opts -> Ok opts { optMinScore = e }) "EPSILON")
"mininum score to aim for",
OptComplNumeric)
OptComplFloat)
oNoHeaders :: OptType
oNoHeaders =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment