summaryrefslogtreecommitdiffstats
path: root/base/java-tools/src
diff options
context:
space:
mode:
Diffstat (limited to 'base/java-tools/src')
-rw-r--r--base/java-tools/src/CMakeLists.txt9
-rw-r--r--base/java-tools/src/com/netscape/cmstools/cli/MainCLI.java11
-rw-r--r--base/java-tools/src/pki-tools.mf2
3 files changed, 22 insertions, 0 deletions
diff --git a/base/java-tools/src/CMakeLists.txt b/base/java-tools/src/CMakeLists.txt
index c01b425a6..d2169e1c2 100644
--- a/base/java-tools/src/CMakeLists.txt
+++ b/base/java-tools/src/CMakeLists.txt
@@ -97,9 +97,18 @@ javac(pki-tools-classes
pki-nsutil pki-cmsutil pki-certsrv
)
+configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/pki-tools.mf
+ ${CMAKE_CURRENT_BINARY_DIR}/pki-tools.mf
+)
+
jar(pki-tools-jar
CREATE
${CMAKE_BINARY_DIR}/dist/pki-tools-${APPLICATION_VERSION}.jar
+ OPTIONS
+ m
+ PARAMS
+ ${CMAKE_CURRENT_BINARY_DIR}/pki-tools.mf
INPUT_DIR
${CMAKE_BINARY_DIR}/classes
FILES
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..] <command> [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);
diff --git a/base/java-tools/src/pki-tools.mf b/base/java-tools/src/pki-tools.mf
new file mode 100644
index 000000000..3cf1821aa
--- /dev/null
+++ b/base/java-tools/src/pki-tools.mf
@@ -0,0 +1,2 @@
+Name: pki-tools
+Implementation-Version: ${APPLICATION_VERSION} \ No newline at end of file