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/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index fb5d2dc..a752c72 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -8,7 +8,7 @@
     security unlock-keychain -p named-data
 fi
 
-ndnsec-keygen "/tmp/jenkins/$NODE_NAME" | ndnsec-install-cert -
+ndnsec key-gen "/tmp/jenkins/$NODE_NAME" | ndnsec cert-install -
 
 # https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
 ASAN_OPTIONS="color=always"
diff --git a/docs/manpages/ndnsec-cert-gen.rst b/docs/manpages/ndnsec-cert-gen.rst
index b3c2724..b433ef8 100644
--- a/docs/manpages/ndnsec-cert-gen.rst
+++ b/docs/manpages/ndnsec-cert-gen.rst
@@ -74,7 +74,7 @@
     YXL9AgIHRm9vIEJhchdHMEUCIQDPT9Hq1kvkE0r9W1aYSBVTnHlTEzgtz+v1DwkC
     ug/vLAIgY3xJITCwf55sqey33q5GIQSk1TRCkNNl58ojvPs5sNU=
 
-    $ ndnsec-dump-certificate -p -f signed.cert
+    $ ndnsec-cert-dump -p -f signed.cert
     Certificate name:
       /example/KEY/%E4%14%99%7F%28%96%82%EB/Universe/%FD%00%00%01q%D1%02N%82
     Validity:
diff --git a/docs/manpages/ndnsec-cert-install.rst b/docs/manpages/ndnsec-cert-install.rst
index dae8ee7..f98b5d4 100644
--- a/docs/manpages/ndnsec-cert-install.rst
+++ b/docs/manpages/ndnsec-cert-install.rst
@@ -43,7 +43,7 @@
 
 Install a certificate via HTTP and set it as the default certificate::
 
-    $ ndnsec-install-cert "http://ndncert.domain.com/cert/get/my-certificate.ndncert"
+    $ ndnsec-cert-install "http://ndncert.domain.com/cert/get/my-certificate.ndncert"
 
 Install a certificate but do not change any default settings::
 
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')
diff --git a/tools/wrapper/ndnsec-certgen.sh b/tools/wrapper/ndnsec-certgen.sh
deleted file mode 100644
index c31d1b2..0000000
--- a/tools/wrapper/ndnsec-certgen.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec cert-gen "$@"
\ No newline at end of file
diff --git a/tools/wrapper/ndnsec-dump-certificate.sh b/tools/wrapper/ndnsec-dump-certificate.sh
deleted file mode 100644
index c0e7c08..0000000
--- a/tools/wrapper/ndnsec-dump-certificate.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec cert-dump "$@"
\ No newline at end of file
diff --git a/tools/wrapper/ndnsec-install-cert.sh b/tools/wrapper/ndnsec-install-cert.sh
deleted file mode 100644
index e89744a..0000000
--- a/tools/wrapper/ndnsec-install-cert.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec cert-install "$@"
\ No newline at end of file
diff --git a/tools/wrapper/ndnsec-keygen.sh b/tools/wrapper/ndnsec-keygen.sh
deleted file mode 100644
index 6dd142d..0000000
--- a/tools/wrapper/ndnsec-keygen.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec key-gen "$@"
\ No newline at end of file
diff --git a/tools/wrapper/ndnsec-ls-identity.sh b/tools/wrapper/ndnsec-ls-identity.sh
deleted file mode 100644
index 4f173bf..0000000
--- a/tools/wrapper/ndnsec-ls-identity.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!@SH@
-
-#to accomodate the old command
-`dirname "$0"`/ndnsec list "$@"
\ No newline at end of file
diff --git a/tools/wscript b/tools/wscript
index b8c2358..8223ab2 100644
--- a/tools/wscript
+++ b/tools/wscript
@@ -43,13 +43,3 @@
                     target=top + 'bin/%s' % name,
                     source=[mainFile],
                     use='ndn-cxx ' + srcObjects)
-
-    # Tool wrappers
-    wrapperFiles = bld.path.ant_glob('wrapper/*.sh')
-    bld(name='tool-wrappers',
-        features='subst',
-        source=wrapperFiles,
-        target=[top + 'bin/%s' % node.change_ext('', '.sh').path_from(bld.path.find_dir('wrapper').get_bld())
-                for node in wrapperFiles],
-        install_path='${BINDIR}',
-        chmod=Utils.O755)