1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-22 16:56:16 +00:00

Added a feature to display the version.

This commit is contained in:
Fabian Schlenz 2016-07-04 15:45:45 +02:00
parent e03f96363f
commit 523ee51d22
3 changed files with 35 additions and 28 deletions

View File

@ -17,13 +17,21 @@ public class CommandLineController {
public UserManager user = null;
public CommandLineController(CommandLineOptions options) {
if (options.cmd_version) {
System.out.println("Telegram_Backup v" + Config.APP_APPVER);
System.out.println("by Fabian Schlenz");
System.exit(0);
} else if (options.cmd_help) {
this.show_help();
}
if (options.target != null) {
Config.FILE_BASE = options.target;
}
System.out.println("Target directory for files: " + Config.FILE_BASE);
if (options.cmd_help) this.show_help();
if (options.cmd_list_accounts) this.list_accounts();
app = new TelegramApp(Config.APP_ID, Config.APP_HASH, Config.APP_MODEL, Config.APP_SYSVER, Config.APP_APPVER, Config.APP_LANG);

View File

@ -9,6 +9,7 @@ class CommandLineOptions {
public boolean cmd_list_accounts = false;
public Integer limit_messages = null;
public String target = null;
public boolean cmd_version = false;
public CommandLineOptions(String[] args) {
String last_cmd = null;
@ -31,35 +32,33 @@ class CommandLineOptions {
}
switch (arg) {
case "--account":
case "-a":
last_cmd = "--account";
continue;
case "--help":
case "-h":
this.cmd_help = true;
break;
case "--login":
case "-l":
this.cmd_login = true;
break;
case "-a": case "--account":
last_cmd = "--account"; continue;
case "-h": case "--help":
this.cmd_help = true; break;
case "-l": case "--login":
this.cmd_login = true; break;
case "--debug":
this.cmd_debug = true;
break;
case "--list-accounts":
case "-A":
this.cmd_list_accounts = true;
break;
this.cmd_debug = true; break;
case "-A": case "--list-accounts":
this.cmd_list_accounts = true; break;
case "--limit-messages":
last_cmd = arg;
continue;
last_cmd = arg; continue;
case "--console":
this.cmd_console = true;
break;
case "--target":
case "-t":
last_cmd = "--target";
continue;
this.cmd_console = true; break;
case "-t": case "--target":
last_cmd = "--target"; continue;
case "-V": case "--version":
this.cmd_version = true; continue;
default:
throw new RuntimeException("Unknown command " + arg);
}

View File

@ -7,7 +7,7 @@ class Config {
public static final String APP_HASH = "16e4ff955cd0adfc058f95ca564f562d";
public static final String APP_MODEL = "Desktop";
public static final String APP_SYSVER = "1.0";
public static final String APP_APPVER = "0.1";
public static final String APP_APPVER = "1.0";
public static final String APP_LANG = "en";
public static String FILE_BASE = System.getProperty("user.home") + File.separatorChar + ".telegram_backup";