From 9368ef42cea4e1e46f22628cffaa29fba66cfec6 Mon Sep 17 00:00:00 2001 From: Endi Sukma Dewata Date: Tue, 25 Sep 2012 00:43:31 -0500 Subject: Added VERSION file. The CMake scripts have been modified to store the version number in /usr/share/pki/VERSION and in JAR manifest files. These files can be read by PKI applications to obtain the version number without having to query the RPM database. Fixed warnings in Java.cmake file. Ticket #339 --- base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'base/java-tools/src/com/netscape') 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 a6350e5d8..44ccf9511 100644 --- a/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java +++ b/base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java @@ -50,6 +50,11 @@ public class MainCLI extends CLI { addModule(new UserCLI(this)); } + public void printVersion() { + Package pkg = MainCLI.class.getPackage(); + System.out.println("PKI Command-Line Interface "+pkg.getImplementationVersion()); + } + public void printHelp() { formatter.printHelp(name+" [OPTIONS..] [ARGS..]", options); @@ -118,6 +123,7 @@ public class MainCLI extends CLI { options.addOption("v", false, "Verbose"); options.addOption(null, "help", false, "Help"); + options.addOption(null, "version", false, "Version"); } public void parseOptions(CommandLine cmd) throws URISyntaxException { @@ -170,6 +176,11 @@ public class MainCLI extends CLI { String[] cmdArgs = cmd.getArgs(); + if (cmd.hasOption("version")) { + printVersion(); + System.exit(1); + } + if (cmdArgs.length == 0 || cmd.hasOption("help")) { printHelp(); System.exit(1); -- cgit