diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-04-13T18·53+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-04-13T18·53+0200 |
commit | ba9ad29fdbfda3836bb06b35817f08fd10beaa22 (patch) | |
tree | 565646143793af4e91ee88630e667bb7976e8686 /src/libmain | |
parent | 6bd9576aeb55927cb551736a47b4e8e3fd1063bb (diff) |
Convert Settings to the new config system
This makes all config options self-documenting. Unknown or unparseable config settings and --option flags now cause a warning.
Diffstat (limited to 'src/libmain')
-rw-r--r-- | src/libmain/common-args.cc | 6 | ||||
-rw-r--r-- | src/libmain/shared.cc | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libmain/common-args.cc b/src/libmain/common-args.cc index 98693d78a7f4..9a7a893138de 100644 --- a/src/libmain/common-args.cc +++ b/src/libmain/common-args.cc @@ -22,7 +22,11 @@ MixCommonArgs::MixCommonArgs(const string & programName) [](Strings ss) { auto name = ss.front(); ss.pop_front(); auto value = ss.front(); - settings.set(name, value); + try { + settings.set(name, value); + } catch (UsageError & e) { + warn(e.what()); + } }); } diff --git a/src/libmain/shared.cc b/src/libmain/shared.cc index c1828aa7db88..9d506d019233 100644 --- a/src/libmain/shared.cc +++ b/src/libmain/shared.cc @@ -138,9 +138,6 @@ void initNix() struct timeval tv; gettimeofday(&tv, 0); srandom(tv.tv_usec); - - if (char *pack = getenv("_NIX_OPTIONS")) - settings.unpack(pack); } @@ -156,10 +153,10 @@ struct LegacyArgs : public MixCommonArgs &settings.verboseBuild, false); mkFlag('K', "keep-failed", "keep temporary directories of failed builds", - &settings.keepFailed); + &(bool&) settings.keepFailed); mkFlag('k', "keep-going", "keep going after a build fails", - &settings.keepGoing); + &(bool&) settings.keepGoing); mkFlag(0, "fallback", "build from source if substitution fails", []() { settings.set("build-fallback", "true"); @@ -184,7 +181,7 @@ struct LegacyArgs : public MixCommonArgs &settings.readOnlyMode); mkFlag(0, "no-build-hook", "disable use of the build hook mechanism", - &settings.useBuildHook, false); + &(bool&) settings.useBuildHook, false); mkFlag(0, "show-trace", "show Nix expression stack trace in evaluation errors", &settings.showTrace); @@ -218,7 +215,6 @@ void parseCmdLine(int argc, char * * argv, std::function<bool(Strings::iterator & arg, const Strings::iterator & end)> parseArg) { LegacyArgs(baseNameOf(argv[0]), parseArg).parseCmdline(argvToStrings(argc, argv)); - settings.update(); } |