Add --version and also display it in UI
authorNiki Roo <niki@nikiroo.be>
Mon, 27 Feb 2017 07:24:08 +0000 (08:24 +0100)
committerNiki Roo <niki@nikiroo.be>
Mon, 27 Feb 2017 07:24:08 +0000 (08:24 +0100)
Makefile.base
configure.sh
libs/nikiroo-utils-1.3.3-sources.jar [moved from libs/nikiroo-utils-1.2.2-sources.jar with 69% similarity]
src/be/nikiroo/fanfix/Instance.java
src/be/nikiroo/fanfix/Main.java
src/be/nikiroo/fanfix/bundles/resources.properties
src/be/nikiroo/fanfix/reader/LocalReaderFrame.java

index 9901644035cee9e0610447751befe4b1e28cb7cc..54dbf1aa548f6a1b9e8e1ee81e2ea1fde4bc03aa 100644 (file)
@@ -94,6 +94,7 @@ resources: libs
                        cp "$$ln" "../bin/$$ln" ; \
                fi ; \
        done
+       @cp VERSION bin/
 
 test-resources: resources
        @echo Copying test resources into bin/...
index ffdf498562370acd1224d82030662ec7ac6d0bb1..42eed0d0259d0e491e8f13c46112fb4a37cb55e4 100755 (executable)
@@ -48,7 +48,7 @@ echo "TEST = be/nikiroo/fanfix/test/Test" >> Makefile
 echo "TEST_PARAMS = $cols $ok $ko" >> Makefile
 echo "NAME = fanfix" >> Makefile
 echo "PREFIX = $PREFIX" >> Makefile
-echo "JAR_FLAGS += -C bin/ org -C bin/ be -C ./ VERSION" >> Makefile
+echo "JAR_FLAGS += -C bin/ org -C bin/ be -C bin/ VERSION" >> Makefile
 #echo "SJAR_FLAGS += -C src/ org -C src/ be -C ./ LICENSE -C ./ README.md -C ./ VERSION" >> Makefile
 
 cat Makefile.base >> Makefile
similarity index 69%
rename from libs/nikiroo-utils-1.2.2-sources.jar
rename to libs/nikiroo-utils-1.3.3-sources.jar
index 62e994f0d55053eaa7f4713b3963b5b4103c12cc..a7c9ff1ee16247db7dc91a0088ee1b5b11a15ca5 100644 (file)
Binary files a/libs/nikiroo-utils-1.2.2-sources.jar and b/libs/nikiroo-utils-1.3.3-sources.jar differ
index 33c65e003aeddc21a7f70e36b342b123a9e6f5ac..fdd73b8d12cd306bd8727cf9fbbae153363139a3 100644 (file)
@@ -38,7 +38,7 @@ public class Instance {
                        configDir = new File(System.getProperty("user.home"), ".fanfix")
                                        .getPath();
                }
-               
+
                if (configDir != null) {
                        if (!new File(configDir).exists()) {
                                new File(configDir).mkdirs();
@@ -149,7 +149,7 @@ public class Instance {
 
        /**
         * Get the (unique) {link StringIdBundle} for the program.
-        *
+        * 
         * @return the {link StringIdBundle}
         */
        public static StringIdBundle getTrans() {
index b989c68a1a3b648f4f96c47398b602ebd6e2814d..06287f1236457860b833399274933202db9e7a55 100644 (file)
@@ -15,6 +15,7 @@ import be.nikiroo.fanfix.reader.BasicReader.ReaderType;
 import be.nikiroo.fanfix.supported.BasicSupport;
 import be.nikiroo.fanfix.supported.BasicSupport.SupportType;
 import be.nikiroo.utils.Progress;
+import be.nikiroo.utils.Version;
 import be.nikiroo.utils.ui.UIUtils;
 
 /**
@@ -24,7 +25,7 @@ import be.nikiroo.utils.ui.UIUtils;
  */
 public class Main {
        private enum MainAction {
-               IMPORT, EXPORT, CONVERT, READ, READ_URL, LIST, HELP, SET_READER, START,
+               IMPORT, EXPORT, CONVERT, READ, READ_URL, LIST, HELP, SET_READER, START, VERSION,
        }
 
        /**
@@ -53,6 +54,7 @@ public class Main {
         * <li>--list ([type]): list the stories present in the library</li>
         * <li>--set-reader [reader type]: set the reader type to CLI or LOCAL for
         * this command</li>
+        * <li>--version: get the version of the program</li>
         * </ul>
         * 
         * @param args
@@ -159,6 +161,8 @@ public class Main {
                        case START:
                                exitCode = 255; // not supposed to be selected by user
                                break;
+                       case VERSION:
+                               exitCode = 255; // no arguments for this option
                        }
                }
 
@@ -212,6 +216,13 @@ public class Main {
                                break;
                        case SET_READER:
                                break;
+                       case VERSION:
+                               System.out
+                                               .println(String.format("Fanfix version %s"
+                                                               + "\nhttps://github.com/nikiroo/fanfix/"
+                                                               + "\n\tWritten by Nikiroo",
+                                                               Version.getCurrentVersion()));
+                               break;
                        case START:
                                UIUtils.setLookAndFeel();
                                BasicReader.setDefaultReaderType(ReaderType.LOCAL);
index 9b01475e2cf9ddf6b4fb97622d7be6e7984ebe16..a317eb1e01f078e98c8ba8113a3c3c7d2c2a542f 100644 (file)
@@ -18,6 +18,7 @@ HELP_SYNTAX = Valid options:\n\
 \t--list: list the stories present in the library\n\
 \t--set-reader [reader type]: set the reader type to CLI or LOCAL for this command\n\
 \t--help: this help message\n\
+\t--version: return the version of the program\n\
 \n\
 Supported input types:\n\
 %s\n\
index 0da34754d9252d71fa2665daadd49310e50822e0..e15ee8d17bb4889ac31061fc8313ad1bab6cb618 100644 (file)
@@ -38,6 +38,7 @@ import be.nikiroo.fanfix.data.Story;
 import be.nikiroo.fanfix.output.BasicOutput.OutputType;
 import be.nikiroo.fanfix.reader.LocalReaderBook.BookActionListener;
 import be.nikiroo.utils.Progress;
+import be.nikiroo.utils.Version;
 import be.nikiroo.utils.ui.ProgressBar;
 import be.nikiroo.utils.ui.WrapLayout;
 
@@ -71,7 +72,7 @@ class LocalReaderFrame extends JFrame {
         *            the type of {@link Story} to load, or NULL for all types
         */
        public LocalReaderFrame(LocalReader reader, String type) {
-               super("Fanfix Library");
+               super(String.format("Fanfix %s Library", Version.getCurrentVersion()));
 
                this.reader = reader;