summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHenner Zeller <h.zeller@acm.org>2020-07-20 12:39:07 -0700
committerEli Ribble <eliribble@google.com>2021-05-06 09:22:26 -0700
commita567ebb6ef75bfda9204900e4fcbcd7ee2785f61 (patch)
tree053a1fdb429f56ee27677454f6c8400f70e50c14 /src
parentce700488e01af33bc478bc986e261e306180b993 (diff)
downloadninja-a567ebb6ef75bfda9204900e4fcbcd7ee2785f61.tar.gz
Add --quiet option that suppresses status updates.
Refined pull request after discussion in #1816 Signed-off-by: Henner Zeller <h.zeller@acm.org>
Diffstat (limited to 'src')
-rw-r--r--src/build.h3
-rw-r--r--src/ninja.cc7
-rw-r--r--src/status.cc3
3 files changed, 10 insertions, 3 deletions
diff --git a/src/build.h b/src/build.h
index 06823c2..d697dfb 100644
--- a/src/build.h
+++ b/src/build.h
@@ -159,8 +159,9 @@ struct BuildConfig {
failures_allowed(1), max_load_average(-0.0f) {}
enum Verbosity {
- NORMAL,
QUIET, // No output -- used when testing.
+ NO_STATUS_UPDATE, // just regular output but suppress status update
+ NORMAL, // regular output and status update
VERBOSE
};
Verbosity verbosity;
diff --git a/src/ninja.cc b/src/ninja.cc
index 56e31e0..ca63f25 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -217,6 +217,7 @@ void Usage(const BuildConfig& config) {
"options:\n"
" --version print ninja version (\"%s\")\n"
" -v, --verbose show all command lines while building\n"
+" --quiet don't show progress updates.\n"
"\n"
" -C DIR change to DIR before doing anything else\n"
" -f FILE specify input build file [default=build.ninja]\n"
@@ -1307,11 +1308,12 @@ int ReadFlags(int* argc, char*** argv,
Options* options, BuildConfig* config) {
config->parallelism = GuessParallelism();
- enum { OPT_VERSION = 1 };
+ enum { OPT_VERSION = 1, OPT_QUIET = 2 };
const option kLongOptions[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, OPT_VERSION },
{ "verbose", no_argument, NULL, 'v' },
+ { "quiet", no_argument, NULL, OPT_QUIET },
{ NULL, 0, NULL, 0 }
};
@@ -1369,6 +1371,9 @@ int ReadFlags(int* argc, char*** argv,
case 'v':
config->verbosity = BuildConfig::VERBOSE;
break;
+ case OPT_QUIET:
+ config->verbosity = BuildConfig::NO_STATUS_UPDATE;
+ break;
case 'w':
if (!WarningEnable(optarg, options))
return 1;
diff --git a/src/status.cc b/src/status.cc
index 171cbeb..88b7781 100644
--- a/src/status.cc
+++ b/src/status.cc
@@ -228,7 +228,8 @@ string StatusPrinter::FormatProgressStatus(const char* progress_status_format,
}
void StatusPrinter::PrintStatus(const Edge* edge, int64_t time_millis) {
- if (config_.verbosity == BuildConfig::QUIET)
+ if (config_.verbosity == BuildConfig::QUIET
+ || config_.verbosity == BuildConfig::NO_STATUS_UPDATE)
return;
bool force_full_command = config_.verbosity == BuildConfig::VERBOSE;