From: Niki Roo Date: Mon, 27 Feb 2017 07:24:08 +0000 (+0100) Subject: Add --version and also display it in UI X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=39c3c6896743a3b6e375d51499036bb32f752114;p=nikiroo-utils.git Add --version and also display it in UI --- diff --git a/Makefile.base b/Makefile.base index 9901644..54dbf1a 100644 --- a/Makefile.base +++ b/Makefile.base @@ -94,6 +94,7 @@ resources: libs cp "$$ln" "../bin/$$ln" ; \ fi ; \ done + @cp VERSION bin/ test-resources: resources @echo Copying test resources into bin/... diff --git a/configure.sh b/configure.sh index ffdf498..42eed0d 100755 --- a/configure.sh +++ b/configure.sh @@ -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 diff --git a/libs/nikiroo-utils-1.2.2-sources.jar b/libs/nikiroo-utils-1.3.3-sources.jar similarity index 69% rename from libs/nikiroo-utils-1.2.2-sources.jar rename to libs/nikiroo-utils-1.3.3-sources.jar index 62e994f..a7c9ff1 100644 Binary files a/libs/nikiroo-utils-1.2.2-sources.jar and b/libs/nikiroo-utils-1.3.3-sources.jar differ diff --git a/src/be/nikiroo/fanfix/Instance.java b/src/be/nikiroo/fanfix/Instance.java index 33c65e0..fdd73b8 100644 --- a/src/be/nikiroo/fanfix/Instance.java +++ b/src/be/nikiroo/fanfix/Instance.java @@ -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() { diff --git a/src/be/nikiroo/fanfix/Main.java b/src/be/nikiroo/fanfix/Main.java index b989c68..06287f1 100644 --- a/src/be/nikiroo/fanfix/Main.java +++ b/src/be/nikiroo/fanfix/Main.java @@ -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 { *
  • --list ([type]): list the stories present in the library
  • *
  • --set-reader [reader type]: set the reader type to CLI or LOCAL for * this command
  • + *
  • --version: get the version of the program
  • * * * @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); diff --git a/src/be/nikiroo/fanfix/bundles/resources.properties b/src/be/nikiroo/fanfix/bundles/resources.properties index 9b01475..a317eb1 100644 --- a/src/be/nikiroo/fanfix/bundles/resources.properties +++ b/src/be/nikiroo/fanfix/bundles/resources.properties @@ -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\ diff --git a/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java b/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java index 0da3475..e15ee8d 100644 --- a/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java +++ b/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java @@ -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;