refacto main

This commit is contained in:
marc barbier
2021-07-10 16:59:44 +02:00
parent 416f0b892e
commit a2a136a9fc
+9 -9
View File
@@ -53,17 +53,17 @@ public class Main {
} }
if (cores <= 0) { if (cores <= 0) {
Log.i("main","java think you have no cpu core... sooo lets go for 4"); Log.i("main","java think you have no cpu core... sooo lets go for 2");
threadNb = Integer.valueOf(4); threadNb = Integer.valueOf(2);
continue; break;
} }
Log.i("main", "running on " + cores + " thread"); Log.i("main", "running on " + cores + " thread");
threadNb = Integer.valueOf(cores); threadNb = Integer.valueOf(cores);
continue; break;
case "-v": case "-v":
verbose = true; verbose = true;
continue; break;
case "--thread": case "--thread":
if (threadNb != null) { if (threadNb != null) {
@@ -77,16 +77,16 @@ public class Main {
String threadNumber = it.next(); String threadNumber = it.next();
if (threadNumber.matches("[0-9]*")) { if (threadNumber.matches("[0-9]*")) {
threadNb = Integer.valueOf(Integer.parseInt(threadNumber)); threadNb = Integer.valueOf(Integer.parseInt(threadNumber));
continue; break;
} }
Log.e("main","arguments invalid please refer to --help"); Log.e("main","arguments invalid please refer to --help");
System.exit(1); System.exit(1);
continue; break;
case "--help": case "--help":
Log.i("main", "use --check to check without updating\nuse --help to see this help\nuse -v to see verbose\nuse --threads to specify the number of threads\nuse -t to set the number of thread automaticaly"); Log.i("main", "use --help to see this help\nuse -v to see verbose\nuse --threads to specify the number of threads\nuse -t to set the number of thread automaticaly");
System.exit(0); System.exit(0);
continue; break;
default: default:
Log.e("main", "unknown args " + cmd + "\nsee --help for help"); Log.e("main", "unknown args " + cmd + "\nsee --help for help");
System.exit(1); System.exit(1);