diff options
Diffstat (limited to 'src/libmain/common-args.cc')
-rw-r--r-- | src/libmain/common-args.cc | 70 |
1 files changed, 61 insertions, 9 deletions
diff --git a/src/libmain/common-args.cc b/src/libmain/common-args.cc index 9c873e22a..9a8f119a3 100644 --- a/src/libmain/common-args.cc +++ b/src/libmain/common-args.cc @@ -6,6 +6,7 @@ namespace nix { MixCommonArgs::MixCommonArgs(const string & programName) : programName(programName) { +<<<<<<< HEAD mkFlag() .longName("verbose") .shortName('v') @@ -30,21 +31,72 @@ MixCommonArgs::MixCommonArgs(const string & programName) .description("set a Nix configuration option (overriding nix.conf)") .arity(2) .handler([](std::vector<std::string> ss) { +||||||| merged common ancestors + mkFlag() + .longName("verbose") + .shortName('v') + .description("increase verbosity level") + .handler([]() { verbosity = (Verbosity) (verbosity + 1); }); + + mkFlag() + .longName("quiet") + .description("decrease verbosity level") + .handler([]() { verbosity = verbosity > lvlError ? (Verbosity) (verbosity - 1) : lvlError; }); + + mkFlag() + .longName("debug") + .description("enable debug output") + .handler([]() { verbosity = lvlDebug; }); + + mkFlag() + .longName("option") + .labels({"name", "value"}) + .description("set a Nix configuration option (overriding nix.conf)") + .arity(2) + .handler([](std::vector<std::string> ss) { +======= + addFlag({ + .longName = "verbose", + .shortName = 'v', + .description = "increase verbosity level", + .handler = {[]() { verbosity = (Verbosity) (verbosity + 1); }}, + }); + + addFlag({ + .longName = "quiet", + .description = "decrease verbosity level", + .handler = {[]() { verbosity = verbosity > lvlError ? (Verbosity) (verbosity - 1) : lvlError; }}, + }); + + addFlag({ + .longName = "debug", + .description = "enable debug output", + .handler = {[]() { verbosity = lvlDebug; }}, + }); + + addFlag({ + .longName = "option", + .description = "set a Nix configuration option (overriding nix.conf)", + .labels = {"name", "value"}, + .handler = {[](std::string name, std::string value) { +>>>>>>> f60ce4fa207a210e23a1142d3a8ead611526e6e1 try { - globalConfig.set(ss[0], ss[1]); + globalConfig.set(name, value); } catch (UsageError & e) { warn(e.what()); } - }); + }}, + }); - mkFlag() - .longName("max-jobs") - .shortName('j') - .label("jobs") - .description("maximum number of parallel builds") - .handler([=](std::string s) { + addFlag({ + .longName = "max-jobs", + .shortName = 'j', + .description = "maximum number of parallel builds", + .labels = Strings{"jobs"}, + .handler = {[=](std::string s) { settings.set("max-jobs", s); - }); + }} + }); std::string cat = "config"; globalConfig.convertToArgs(*this, cat); |