2016-02-09 21:07:48 +01:00
|
|
|
#include "common-args.hh"
|
|
|
|
#include "globals.hh"
|
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
MixCommonArgs::MixCommonArgs(const string & programName)
|
2016-02-09 21:28:29 +01:00
|
|
|
: programName(programName)
|
2016-02-09 21:07:48 +01:00
|
|
|
{
|
|
|
|
mkFlag('v', "verbose", "increase verbosity level", []() {
|
|
|
|
verbosity = (Verbosity) (verbosity + 1);
|
|
|
|
});
|
|
|
|
|
|
|
|
mkFlag(0, "quiet", "decrease verbosity level", []() {
|
|
|
|
verbosity = verbosity > lvlError ? (Verbosity) (verbosity - 1) : lvlError;
|
|
|
|
});
|
|
|
|
|
|
|
|
mkFlag(0, "debug", "enable debug output", []() {
|
|
|
|
verbosity = lvlDebug;
|
|
|
|
});
|
|
|
|
|
|
|
|
mkFlag(0, "option", {"name", "value"}, "set a Nix configuration option (overriding nix.conf)", 2,
|
|
|
|
[](Strings ss) {
|
|
|
|
auto name = ss.front(); ss.pop_front();
|
|
|
|
auto value = ss.front();
|
2017-04-13 20:53:23 +02:00
|
|
|
try {
|
|
|
|
settings.set(name, value);
|
|
|
|
} catch (UsageError & e) {
|
|
|
|
warn(e.what());
|
|
|
|
}
|
2016-02-09 21:07:48 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|