nix: Support -j flag

This commit is contained in:
Eelco Dolstra 2019-06-15 16:34:06 +02:00
parent 7ce60a81ba
commit 34fa8ce917
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 9 additions and 4 deletions

View file

@ -35,6 +35,15 @@ MixCommonArgs::MixCommonArgs(const string & programName)
} }
}); });
mkFlag()
.longName("max-jobs")
.shortName('j')
.label("jobs")
.description("maximum number of parallel builds")
.handler([=](std::string s) {
settings.set("max-jobs", s);
});
std::string cat = "config"; std::string cat = "config";
globalConfig.convertToArgs(*this, cat); globalConfig.convertToArgs(*this, cat);

View file

@ -175,10 +175,6 @@ LegacyArgs::LegacyArgs(const std::string & programName,
.description("build from source if substitution fails") .description("build from source if substitution fails")
.set(&(bool&) settings.tryFallback, true); .set(&(bool&) settings.tryFallback, true);
mkFlag1('j', "max-jobs", "jobs", "maximum number of parallel builds", [=](std::string s) {
settings.set("max-jobs", s);
});
auto intSettingAlias = [&](char shortName, const std::string & longName, auto intSettingAlias = [&](char shortName, const std::string & longName,
const std::string & description, const std::string & dest) { const std::string & description, const std::string & dest) {
mkFlag<unsigned int>(shortName, longName, description, [=](unsigned int n) { mkFlag<unsigned int>(shortName, longName, description, [=](unsigned int n) {