aboutsummaryrefslogtreecommitdiff
path: root/src/libmain
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-05-12 14:20:32 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-05-12 14:20:32 +0000
commitefa5fa1a91d5c4b29094d99b65e18b583d86dbc7 (patch)
tree4e8bc72214e48c9acd1bd342fe2e315217ce18f6 /src/libmain
parent1f48aa0be7f1fe120cee44a208480b879583c5f8 (diff)
* A switch `-j NUMBER' to set the maximum number of parallel jobs (0 =
no limit). * Add missing file to distribution.
Diffstat (limited to 'src/libmain')
-rw-r--r--src/libmain/shared.cc19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc
index 95552a361..feca410f4 100644
--- a/src/libmain/shared.cc
+++ b/src/libmain/shared.cc
@@ -118,16 +118,29 @@ static void initAndRun(int argc, char * * argv)
++i;
if (i == args.end()) throw UsageError("`--log-type' requires an argument");
setLogType(*i);
- } else if (arg == "--build-output" || arg == "-B")
+ }
+ else if (arg == "--build-output" || arg == "-B")
buildVerbosity = lvlError; /* lowest */
else if (arg == "--help") {
printHelp();
return;
- } else if (arg == "--version") {
+ }
+ else if (arg == "--version") {
cout << format("%1% (Nix) %2%") % programId % NIX_VERSION << endl;
return;
- } else if (arg == "--keep-failed" || arg == "-K")
+ }
+ else if (arg == "--keep-failed" || arg == "-K")
keepFailed = true;
+ else if (arg == "--max-jobs" || arg == "-j") {
+ ++i;
+ if (i == args.end()) throw UsageError("`--max-jobs' requires an argument");
+ istringstream str(*i);
+ int n;
+ str >> n;
+ if (!str || !str.eof() || n < 0)
+ throw UsageError(format("`--max-jobs' requires a non-negative integer"));
+ maxBuildJobs = n;
+ }
else remaining.push_back(arg);
}