diff options
author | multi <depot@in-addr.xyz> | 2020-11-27T19·43+0000 |
---|---|---|
committer | multi <depot@in-addr.xyz> | 2020-11-27T21·03+0000 |
commit | c885bd0274ba878d336e440651994c5d265c54dd (patch) | |
tree | e582fdb4f50214de026d61665df64158a224a29f | |
parent | 5c3d58bb60c846f503d10af7fc5ba6e9f42fbae9 (diff) |
fix(tvix): globally reintroduce --quiet and --verbose flags. r/1944
The --quiet and -v/--verbose flags were removed during the glog conversion in d0c44425e147ab7d38410f400825ad20da15037b, which has previously broken programs like e.g. home-manager, which passes --quiet to nix-build. A nix-build-specific workaround was added in 24f9354d5b8e1521d00f41a7c100b8e9ad327ce7, which manipulates the FLAGS_stderrthreshold global variable from glog. This commit moves the --quiet logic back into the argument handling code in libmain, and adds corresponding handling for -v/--verbose. Change-Id: I13d860ebbb78541d9f1236691a1efe8bd2163c67 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2170 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
-rw-r--r-- | third_party/nix/src/libmain/common-args.cc | 14 | ||||
-rw-r--r-- | third_party/nix/src/nix-build/nix-build.cc | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/third_party/nix/src/libmain/common-args.cc b/third_party/nix/src/libmain/common-args.cc index 0000605d454a..729e026f1990 100644 --- a/third_party/nix/src/libmain/common-args.cc +++ b/third_party/nix/src/libmain/common-args.cc @@ -9,6 +9,20 @@ namespace nix { MixCommonArgs::MixCommonArgs(const std::string& programName) : programName(programName) { mkFlag() + .longName("verbose") + .shortName('v') + .description("increase verbosity level") + .handler([]() { + FLAGS_stderrthreshold = google::GLOG_INFO; + FLAGS_v += 1; + }); + + mkFlag() + .longName("quiet") + .description("silence all log output") + .handler([]() { FLAGS_stderrthreshold = google::GLOG_FATAL; }); + + mkFlag() .longName("option") .labels({"name", "value"}) .description("set a Nix configuration option (overriding nix.conf)") diff --git a/third_party/nix/src/nix-build/nix-build.cc b/third_party/nix/src/nix-build/nix-build.cc index c5a34a8475a3..26c308967724 100644 --- a/third_party/nix/src/nix-build/nix-build.cc +++ b/third_party/nix/src/nix-build/nix-build.cc @@ -242,8 +242,6 @@ static void _main(int argc, char** argv) { else if (*arg == "--keep") { keepVars.insert(getArg(*arg, arg, end)); - } else if (*arg == "--quiet") { - FLAGS_stderrthreshold = google::GLOG_FATAL; } else if (*arg == "-") { readStdin = true; |