The MainCLI has been modified to generate a deprecation warning
for the -t option.

--
Endi S. Dewata
>From 0c8aedd8a79841751005c531cf6cfbc08a4fd4dd Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <[email protected]>
Date: Sat, 8 Apr 2017 09:05:48 +0200
Subject: [PATCH] Deprecated -t option for pki CLI.

The MainCLI has been modified to generate a deprecation warning
for the -t option.

Change-Id: I28ac45954a900f6944528ef52913982d72896c92
---
 base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
index d7aa54c09664e76f2e5d4aec7b5088a4d3dfd211..1b9c569065a2c7f6c9910bf8ff92d5fb9104d397 100644
--- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
+++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java
@@ -124,12 +124,12 @@ public class MainCLI extends CLI {
 
     public void printVersion() {
         Package pkg = MainCLI.class.getPackage();
-        System.out.println("PKI Command-Line Interface "+pkg.getImplementationVersion());
+        System.out.println("PKI Command-Line Interface " + pkg.getImplementationVersion());
     }
 
     public void printHelp() {
 
-        formatter.printHelp(name+" [OPTIONS..] <command> [ARGS..]", options);
+        formatter.printHelp(name + " [OPTIONS..] <command> [ARGS..]", options);
         System.out.println();
 
         int leftPadding = 1;
@@ -169,7 +169,7 @@ public class MainCLI extends CLI {
         option.setArgName("port");
         options.addOption(option);
 
-        option = new Option("t", true, "Subsystem type");
+        option = new Option("t", true, "Subsystem type (deprecated)");
         option.setArgName("type");
         options.addOption(option);
 
@@ -340,8 +340,10 @@ public class MainCLI extends CLI {
         if (uri == null)
             uri = protocol + "://" + hostname + ":" + port;
 
-        if (subsystem != null)
+        if (subsystem != null) {
+            System.err.println("WARNING: The -t option has been deprecated. Use pki " + subsystem + " command instead.");
             uri = uri + "/" + subsystem;
+        }
 
         config.setServerURI(uri);
 
-- 
2.9.3

_______________________________________________
Pki-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/pki-devel

Reply via email to