tools: make nfdc smarter when the user asks for help

Now 'nfdc foo help', 'nfdc foo --help', and 'nfdc foo -h'
are all accepted as synonyms of 'nfdc help foo'.

Additionally, '--version' can be used in place of '-V'.

Change-Id: I070bb0ea9231a2642c40938377f1e9af2630b34e
Refs: #4503
diff --git a/tools/nfdc/help.cpp b/tools/nfdc/help.cpp
index 902bf67..e67992c 100644
--- a/tools/nfdc/help.cpp
+++ b/tools/nfdc/help.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -25,7 +25,9 @@
 
 #include "help.hpp"
 #include "format-helpers.hpp"
+
 #include <ndn-cxx/util/logger.hpp>
+
 #include <unistd.h>
 
 namespace nfd {
@@ -39,7 +41,7 @@
 void
 helpList(std::ostream& os, const CommandParser& parser, ParseMode mode, const std::string& noun)
 {
-  os << "nfdc [-h] [-V] <command> [<args>]\n\n";
+  os << "nfdc [-h|--help] [-V|--version] <command> [<args>]\n\n";
   if (noun.empty()) {
     os << "All subcommands:\n";
   }
@@ -64,25 +66,25 @@
 }
 
 static void
-helpSingle(const std::string& noun, const std::string& verb)
+helpCommand(const std::string& noun, const std::string& verb)
 {
   std::string manpage = "nfdc-" + noun;
 
-  execlp("man", "man", manpage.data(), nullptr);
+  ::execlp("man", "man", manpage.data(), nullptr);
   NDN_LOG_FATAL("Error opening man page for " << manpage);
 }
 
 void
 help(ExecuteContext& ctx, const CommandParser& parser)
 {
-  std::string noun = ctx.args.get<std::string>("noun", "");
-  std::string verb = ctx.args.get<std::string>("verb", "");
+  auto noun = ctx.args.get<std::string>("noun", "");
+  auto verb = ctx.args.get<std::string>("verb", "");
 
   if (noun.empty()) {
-    helpList(ctx.out, parser, ParseMode::ONE_SHOT, noun);
+    helpList(ctx.out, parser);
   }
   else {
-    helpSingle(noun, verb); // should not return
+    helpCommand(noun, verb); // should not return
     ctx.exitCode = 1;
   }
 }