From 930239466bd58711abc9915cb40b91eea222e76f Mon Sep 17 00:00:00 2001 From: Cr4zyFl1x Date: Sun, 10 Oct 2021 21:57:11 +0200 Subject: [PATCH] Updated: Added argument to get current version of JavaLogger --- src/eu/cr4zyfl1x/logger/Logger.java | 13 +++++++++++++ src/eu/cr4zyfl1x/logger/Main.java | 7 +++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/eu/cr4zyfl1x/logger/Logger.java b/src/eu/cr4zyfl1x/logger/Logger.java index 57971ba..2e969b6 100644 --- a/src/eu/cr4zyfl1x/logger/Logger.java +++ b/src/eu/cr4zyfl1x/logger/Logger.java @@ -11,6 +11,11 @@ */ public class Logger { + /** + * Logger version string + */ + private static final String version = "1.0.0"; + /** * Loaded logger */ @@ -173,4 +178,12 @@ public static void log(LogType l, String message, boolean logInFile) { Logger.logger.writeEntryToLogfile(logEntry); } } + + /** + * Gets the Version of the Logger + * @return Version string + */ + public static String getVersion() { + return version; + } } diff --git a/src/eu/cr4zyfl1x/logger/Main.java b/src/eu/cr4zyfl1x/logger/Main.java index e3b3344..7e06fd9 100644 --- a/src/eu/cr4zyfl1x/logger/Main.java +++ b/src/eu/cr4zyfl1x/logger/Main.java @@ -5,7 +5,10 @@ public class Main { public static void main(String[] args) { - System.out.println("This is not an executable software!\nYou're trying to execute a Java Library.\n\nMore information:\nhttps://github.com/Cr4zyFl1x/JavaLogger"); - JOptionPane.showMessageDialog(null, "This is not an executable software!\nYou're trying to execute a Java Library.\n\nMore information:\nhttps://github.com/Cr4zyFl1x/JavaLogger", "JavaLogger", JOptionPane.INFORMATION_MESSAGE); + + if (args.length == 0) { + System.out.println("This is not an executable software!\nYou're trying to execute a Java Library.\n\nLogger version -> java -jar logger.jar version\n\nMore information:\nhttps://github.com/Cr4zyFl1x/JavaLogger"); + JOptionPane.showMessageDialog(null, "This is not an executable software!\nYou're trying to execute a Java Library.\n\nMore information:\nhttps://github.com/Cr4zyFl1x/JavaLogger", "JavaLogger", JOptionPane.INFORMATION_MESSAGE); + } else if (args[0].equals("version")) System.out.println(Logger.getVersion()); } }