1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-23 01:06:17 +00:00

Cleaned up CommandLineOptions.

This commit is contained in:
Fabian Schlenz 2016-07-11 18:17:42 +02:00
parent 6499aed3c1
commit fefebc9cd6

View File

@ -17,18 +17,19 @@
package de.fabianonline.telegram_backup; package de.fabianonline.telegram_backup;
class CommandLineOptions { class CommandLineOptions {
public static boolean cmd_console = false; public static boolean cmd_console = false;
public static String val_account = null; public static boolean cmd_help = false;
public static boolean cmd_help = false; public static boolean cmd_login = false;
public static boolean cmd_login = false; public static boolean cmd_debug = false;
public static boolean cmd_debug = false; public static boolean cmd_list_accounts = false;
public static boolean cmd_list_accounts = false; public static boolean cmd_version = false;
public static boolean cmd_license = false;
public static boolean cmd_daemon = false;
public static String val_account = null;
public static Integer val_limit_messages = null; public static Integer val_limit_messages = null;
public static String val_target = null; public static String val_target = null;
public static boolean cmd_version = false; public static String val_export = null;
public static String val_export = null;
public static boolean cmd_license = false;
public static boolean cmd_daemon = false;
public static void parseOptions(String[] args) { public static void parseOptions(String[] args) {
String last_cmd = null; String last_cmd = null;
@ -37,17 +38,16 @@ class CommandLineOptions {
if (last_cmd != null) { if (last_cmd != null) {
switch (last_cmd) { switch (last_cmd) {
case "--account": case "--account":
val_account = arg; val_account = arg; break;
break;
case "--limit-messages": case "--limit-messages":
val_limit_messages = Integer.parseInt(arg); val_limit_messages = Integer.parseInt(arg); break;
break;
case "--target": case "--target":
val_target = arg; val_target = arg; break;
break;
case "--export": case "--export":
val_export = arg; val_export = arg; break;
break;
} }
last_cmd = null; last_cmd = null;
continue; continue;
@ -55,7 +55,7 @@ class CommandLineOptions {
switch (arg) { switch (arg) {
case "-a": case "--account": case "-a": case "--account":
last_cmd = "--account"; continue; last_cmd = "--account"; continue;
case "-h": case "--help": case "-h": case "--help":
cmd_help = true; break; cmd_help = true; break;
@ -70,19 +70,19 @@ class CommandLineOptions {
cmd_list_accounts = true; break; cmd_list_accounts = true; break;
case "--limit-messages": case "--limit-messages":
last_cmd = arg; continue; last_cmd = arg; continue;
case "--console": case "--console":
cmd_console = true; break; cmd_console = true; break;
case "-t": case "--target": case "-t": case "--target":
last_cmd = "--target"; continue; last_cmd = "--target"; continue;
case "-V": case "--version": case "-V": case "--version":
cmd_version = true; break; cmd_version = true; break;
case "-e": case "--export": case "-e": case "--export":
last_cmd = "--export"; continue; last_cmd = "--export"; continue;
case "--license": case "--license":
cmd_license = true; break; cmd_license = true; break;