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 {