Add --quiet option that suppresses status updates.

Refined pull request after discussion in #1816

Signed-off-by: Henner Zeller <h.zeller@acm.org>
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 @@
                   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 @@
 "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 @@
               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 @@
       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 @@
 }
 
 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;