X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=inline;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Ftui%2FMain.java;h=6f12a2b7dba4c161daa1f6a029ea89c070ee9522;hb=e253bd50bb05519f4a16fed4fb95d5b3340128ea;hp=db6e522c72ed61cc3b0a317e0fc21c97b2c255b8;hpb=176a83279a5aafb7e44cc7c34bf78f0bc35225fe;p=jvcard.git
diff --git a/src/be/nikiroo/jvcard/tui/Main.java b/src/be/nikiroo/jvcard/tui/Main.java
index db6e522..6f12a2b 100644
--- a/src/be/nikiroo/jvcard/tui/Main.java
+++ b/src/be/nikiroo/jvcard/tui/Main.java
@@ -9,6 +9,7 @@ import java.util.List;
import be.nikiroo.jvcard.i18n.Trans;
import be.nikiroo.jvcard.i18n.Trans.StringId;
+import be.nikiroo.jvcard.resources.Bundles;
import be.nikiroo.jvcard.tui.panes.FileList;
import com.googlecode.lanterna.gui2.Window;
@@ -24,7 +25,7 @@ import com.googlecode.lanterna.input.KeyStroke;
*/
public class Main {
public static final String APPLICATION_TITLE = "jVcard";
- public static final String APPLICATION_VERSION = "1.0-beta2";
+ public static final String APPLICATION_VERSION = "1.0-beta2-dev";
static private Trans transService;
@@ -62,7 +63,8 @@ public class Main {
* Start the application.
*
* @param args
- * the parameters (see --help to know hich are supported)
+ * the parameters (see --help to know which are
+ * supported)
*/
public static void main(String[] args) {
Boolean textMode = null;
@@ -72,9 +74,9 @@ public class Main {
// get the "system default" language to help translate the --help
// message if needed
String language = null;
- transService = new Trans(null);
+ transService = new Trans(language);
- List files = new LinkedList();
+ List files = new LinkedList();
for (int index = 0; index < args.length; index++) {
String arg = args[index];
if (!noMoreParams && arg.equals("--")) {
@@ -89,8 +91,9 @@ public class Main {
+ "\t--tui: force pure text mode even if swing treminal is available\n"
+ "\t--gui: force swing terminal mode\n"
+ "\t--noutf: force non-utf8 mode if you need it\n"
+ + "\t--config DIRECTORY: force the given directory as a CONFIG_DIR\n"
+ "everyhing else is either a file to open or a directory to open\n"
- + "(we will only open 1st level files in given directories)");
+ + "(we will only open 1st level files in given directories)\n");
return;
} else if (!noMoreParams && arg.equals("--tui")) {
textMode = true;
@@ -103,6 +106,12 @@ public class Main {
if (index < args.length)
language = args[index];
transService = new Trans(language);
+ } else if (!noMoreParams && arg.equals("--config")) {
+ index++;
+ if (index < args.length) {
+ Bundles.setDirectory(args[index]);
+ transService = new Trans(language);
+ }
} else {
filesTried = true;
files.addAll(open(arg));
@@ -141,18 +150,18 @@ public class Main {
*
* @return the list of opened files
*/
- static private List open(String path) {
- List files = new LinkedList();
+ static private List open(String path) {
+ List files = new LinkedList();
File file = new File(path);
if (file.exists()) {
if (file.isDirectory()) {
for (File subfile : file.listFiles()) {
if (!subfile.isDirectory())
- files.add(subfile);
+ files.add(subfile.getAbsolutePath());
}
} else {
- files.add(file);
+ files.add(file.getAbsolutePath());
}
} else {
System.err.println("File or directory not found: \"" + path + "\"");
@@ -170,8 +179,10 @@ public class Main {
Field charset = Charset.class.getDeclaredField("defaultCharset");
charset.setAccessible(true);
charset.set(null, null);
- } catch (SecurityException | NoSuchFieldException
- | IllegalArgumentException | IllegalAccessException e) {
+ } catch (SecurityException e) {
+ } catch (NoSuchFieldException e) {
+ } catch (IllegalArgumentException e) {
+ } catch (IllegalAccessException e) {
}
}
}