diff --git a/src/main/java/de/fabianonline/telegram_backup/CommandLineController.java b/src/main/java/de/fabianonline/telegram_backup/CommandLineController.java index 107fa1d..95feddb 100644 --- a/src/main/java/de/fabianonline/telegram_backup/CommandLineController.java +++ b/src/main/java/de/fabianonline/telegram_backup/CommandLineController.java @@ -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); diff --git a/src/main/java/de/fabianonline/telegram_backup/CommandLineOptions.java b/src/main/java/de/fabianonline/telegram_backup/CommandLineOptions.java index ca7cc97..cbba44a 100644 --- a/src/main/java/de/fabianonline/telegram_backup/CommandLineOptions.java +++ b/src/main/java/de/fabianonline/telegram_backup/CommandLineOptions.java @@ -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); } diff --git a/src/main/java/de/fabianonline/telegram_backup/Config.java b/src/main/java/de/fabianonline/telegram_backup/Config.java index 268fe1e..616bc1e 100644 --- a/src/main/java/de/fabianonline/telegram_backup/Config.java +++ b/src/main/java/de/fabianonline/telegram_backup/Config.java @@ -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";