Commit e7493cad authored by Niklas Hambüchen's avatar Niklas Hambüchen
Browse files

Distribution.Simple.Setup: Clean up + refactor list

parent 7986a022
......@@ -1424,26 +1424,24 @@ buildCommand progConf = makeCommand name shortDesc longDesc
buildOptions :: ProgramConfiguration -> ShowOrParseArgs
-> [OptionField BuildFlags]
buildOptions progConf showOrParseArgs =
optionVerbosity buildVerbosity (\v flags -> flags { buildVerbosity = v })
: optionDistPref
buildDistPref (\d flags -> flags { buildDistPref = d })
showOrParseArgs
[ optionVerbosity
buildVerbosity (\v flags -> flags { buildVerbosity = v })
: option "j" ["jobs"]
"Run NUM jobs simultaneously (or '$ncpus' if no NUM is given)"
buildNumJobs (\v flags -> flags { buildNumJobs = v })
(optArg "NUM" (fmap Flag numJobsParser)
(Flag Nothing)
(map (Just . maybe "$ncpus" show) . flagToList))
, optionDistPref
buildDistPref (\d flags -> flags { buildDistPref = d }) showOrParseArgs
: programConfigurationPaths progConf showOrParseArgs
buildProgramPaths (\v flags -> flags { buildProgramPaths = v})
, optionNumJobs
buildNumJobs (\v flags -> flags { buildNumJobs = v })
] ++
++ programConfigurationOption progConf showOrParseArgs
buildProgramArgs (\v fs -> fs { buildProgramArgs = v })
programConfigurationPaths progConf showOrParseArgs
buildProgramPaths (\v flags -> flags { buildProgramPaths = v}) ++
++ programConfigurationOptions progConf showOrParseArgs
buildProgramArgs (\v flags -> flags { buildProgramArgs = v})
programConfigurationOption progConf showOrParseArgs
buildProgramArgs (\v fs -> fs { buildProgramArgs = v }) ++
programConfigurationOptions progConf showOrParseArgs
buildProgramArgs (\v flags -> flags { buildProgramArgs = v})
emptyBuildFlags :: BuildFlags
emptyBuildFlags = mempty
......@@ -1899,6 +1897,17 @@ optionVerbosity get set =
(Flag verbose) -- default Value if no n is given
(fmap (Just . showForCabal) . flagToList))
optionNumJobs :: (flags -> Flag (Maybe Int))
-> (Flag (Maybe Int) -> flags -> flags)
-> OptionField flags
optionNumJobs get set =
option "j" ["jobs"]
"Run NUM jobs simultaneously (or '$ncpus' if no NUM is given)."
get set
(optArg "NUM" (fmap Flag numJobsParser)
(Flag Nothing)
(map (Just . maybe "$ncpus" show) . flagToList))
-- ------------------------------------------------------------
-- * Other Utils
-- ------------------------------------------------------------
......
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