chunks: print summary by default
Introduce -q/--quiet option to suppress all output.
Change-Id: Ib529849cb1ca8975d11ce6689e2d88708291d1c4
Refs: #4421
diff --git a/tools/chunks/catchunks/ndncatchunks.cpp b/tools/chunks/catchunks/ndncatchunks.cpp
index 768dd7a..497197f 100644
--- a/tools/chunks/catchunks/ndncatchunks.cpp
+++ b/tools/chunks/catchunks/ndncatchunks.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2017, Regents of the University of California,
+ * Copyright (c) 2016-2018, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -78,7 +78,8 @@
"lifetime of expressed Interests, in milliseconds")
("retries,r", po::value<int>(&options.maxRetriesOnTimeoutOrNack)->default_value(options.maxRetriesOnTimeoutOrNack),
"maximum number of retries in case of Nack or timeout (-1 = no limit)")
- ("verbose,v", po::bool_switch(&options.isVerbose), "turn on verbose output")
+ ("quiet,q", po::bool_switch(&options.isQuiet), "suppress all diagnostic output, except fatal errors")
+ ("verbose,v", po::bool_switch(&options.isVerbose), "turn on verbose output (per segment information")
("version,V", "print program version and exit")
;
@@ -208,9 +209,13 @@
std::cerr << "ERROR: lifetime cannot be negative" << std::endl;
return 2;
}
-
options.interestLifetime = time::milliseconds(vm["lifetime"].as<int64_t>());
+ if (options.isQuiet && options.isVerbose) {
+ std::cerr << "ERROR: cannot be quiet and verbose at the same time" << std::endl;
+ return 2;
+ }
+
try {
Face face;
@@ -288,8 +293,7 @@
return 2;
}
- Consumer consumer(security::v2::getAcceptAllValidator(), options.isVerbose);
-
+ Consumer consumer(security::v2::getAcceptAllValidator());
BOOST_ASSERT(discover != nullptr);
BOOST_ASSERT(pipeline != nullptr);
consumer.run(std::move(discover), std::move(pipeline));
@@ -299,6 +303,10 @@
std::cerr << "ERROR: " << e.what() << std::endl;
return 3;
}
+ catch (const Consumer::DataValidationError& e) {
+ std::cerr << "ERROR: " << e.what() << std::endl;
+ return 5;
+ }
catch (const std::exception& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
return 1;