chunks: improve help text of ndnputchunks
refs #3772
Change-Id: I17c3be0cca53904f160c61893abac28edfc73134
diff --git a/tools/chunks/putchunks/ndnputchunks.cpp b/tools/chunks/putchunks/ndnputchunks.cpp
index 202cd83..195d2ca 100644
--- a/tools/chunks/putchunks/ndnputchunks.cpp
+++ b/tools/chunks/putchunks/ndnputchunks.cpp
@@ -28,9 +28,19 @@
#include "core/version.hpp"
#include "producer.hpp"
+namespace po = boost::program_options;
+
namespace ndn {
namespace chunks {
+static void
+usage(std::ostream& os, const std::string& programName, const po::options_description& visibleDesc) {
+ os << "Usage: " << programName << " [options] ndn:/name" << std::endl;
+ os << "\nPublish data under specified prefix. "
+ << "Note: this tool expects data from the standard input.\n" << std::endl;
+ os << visibleDesc;
+}
+
static int
main(int argc, char** argv)
{
@@ -42,7 +52,6 @@
bool isVerbose = false;
std::string prefix;
- namespace po = boost::program_options;
po::options_description visibleDesc("Options");
visibleDesc.add_options()
("help,h", "print this help message and exit")
@@ -82,8 +91,7 @@
}
if (vm.count("help") > 0) {
- std::cout << "Usage: " << programName << " [options] ndn:/name" << std::endl;
- std::cout << visibleDesc;
+ usage(std::cout, programName, visibleDesc);
return 0;
}
@@ -93,8 +101,7 @@
}
if (prefix.empty()) {
- std::cerr << "Usage: " << programName << " [options] ndn:/name" << std::endl;
- std::cerr << visibleDesc;
+ usage(std::cerr, programName, visibleDesc);
return 2;
}