tools: deprecate old ndnsec command aliases

These are: ndnsec-certgen, ndnsec-dump-certificate,
ndnsec-install-cert, ndnsec-keygen, ndnsec-ls-identity

Change-Id: I0fbc65d2a08f8e7812fd7e62cf6618ffe62671de
diff --git a/tools/ndnsec/main.cpp b/tools/ndnsec/main.cpp
index 9c8e64e..024e5d5 100644
--- a/tools/ndnsec/main.cpp
+++ b/tools/ndnsec/main.cpp
@@ -50,6 +50,14 @@
 
 Try 'ndnsec COMMAND --help' for more information on each command.)STR";
 
+const std::map<std::string, std::string> deprecatedCommands{
+  {"certgen",           "cert-gen"},
+  {"dump-certificate",  "cert-dump"},
+  {"install-cert",      "cert-install"},
+  {"keygen",            "key-gen"},
+  {"ls-identity",       "list"},
+};
+
 int
 main(int argc, char* argv[])
 {
@@ -58,6 +66,12 @@
   std::string command;
   if (basename.rfind("ndnsec-", 0) == 0) {
     command = basename.substr(std::strlen("ndnsec-"));
+    auto it = deprecatedCommands.find(command);
+    if (it != deprecatedCommands.end()) {
+      std::cerr << "DEPRECATION NOTICE: ndnsec-" << it->first << " is deprecated. "
+                << "Please use 'ndnsec " << it->second << "' instead.\n";
+      command = it->second;
+    }
   }
   else if (argc >= 2) {
     command = argv[1];
@@ -68,6 +82,7 @@
     std::cerr << NDNSEC_HELP_TEXT << std::endl;
     return 2;
   }
+
   NDN_LOG_TRACE("Command: " << command);
 
   try {
diff --git a/tools/ndnsec/wscript b/tools/ndnsec/wscript
index caac9fc..55f557f 100644
--- a/tools/ndnsec/wscript
+++ b/tools/ndnsec/wscript
@@ -14,7 +14,11 @@
                 source=['main.cpp'],
                 use='tool-ndnsec-objects')
 
+    # create convenience symlinks
     for cmd in ('list', 'get-default', 'set-default', 'delete',
                 'key-gen', 'sign-req', 'cert-gen', 'cert-install',
-                'cert-dump', 'export', 'import', 'unlock-tpm'):
+                'cert-dump', 'export', 'import', 'unlock-tpm',
+                # deprecated aliases
+                'certgen', 'dump-certificate', 'install-cert',
+                'keygen', 'ls-identity'):
         bld.symlink_as('${BINDIR}/ndnsec-%s' % cmd, 'ndnsec')