mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-23 01:06:17 +00:00
Files get saved to the user dir by default, but you can change this value by using '--target'.
This commit is contained in:
parent
07ba594a15
commit
e03f96363f
@ -17,6 +17,11 @@ public class CommandLineController {
|
||||
public UserManager user = null;
|
||||
|
||||
public CommandLineController(CommandLineOptions options) {
|
||||
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();
|
||||
@ -94,12 +99,13 @@ public class CommandLineController {
|
||||
|
||||
private void show_help() {
|
||||
System.out.println("Valid options are:");
|
||||
System.out.println(" --help Shows this help.");
|
||||
System.out.println(" --account <x> Use account <x>.");
|
||||
System.out.println(" --login Login to an existing telegram account.");
|
||||
System.out.println(" -h, --help Shows this help.");
|
||||
System.out.println(" -a, --account <x> Use account <x>.");
|
||||
System.out.println(" -l, --login Login to an existing telegram account.");
|
||||
System.out.println(" --debug Show (lots of) debug information.");
|
||||
System.out.println(" --list-accounts List all existing accounts ");
|
||||
System.out.println(" -A, --list-accounts List all existing accounts ");
|
||||
System.out.println(" --limit-messages <x> Downloads at most the most recent <x> messages.");
|
||||
System.out.println(" -t, --target <x> Target directory for the files.");
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ class CommandLineOptions {
|
||||
public boolean cmd_debug = false;
|
||||
public boolean cmd_list_accounts = false;
|
||||
public Integer limit_messages = null;
|
||||
public String target = null;
|
||||
|
||||
public CommandLineOptions(String[] args) {
|
||||
String last_cmd = null;
|
||||
@ -21,6 +22,9 @@ class CommandLineOptions {
|
||||
case "--limit-messages":
|
||||
this.limit_messages = Integer.parseInt(arg);
|
||||
break;
|
||||
case "--target":
|
||||
this.target = arg;
|
||||
break;
|
||||
}
|
||||
last_cmd = null;
|
||||
continue;
|
||||
@ -28,18 +32,22 @@ class CommandLineOptions {
|
||||
|
||||
switch (arg) {
|
||||
case "--account":
|
||||
last_cmd = arg;
|
||||
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 "--debug":
|
||||
this.cmd_debug = true;
|
||||
break;
|
||||
case "--list-accounts":
|
||||
case "-A":
|
||||
this.cmd_list_accounts = true;
|
||||
break;
|
||||
case "--limit-messages":
|
||||
@ -48,6 +56,10 @@ class CommandLineOptions {
|
||||
case "--console":
|
||||
this.cmd_console = true;
|
||||
break;
|
||||
case "--target":
|
||||
case "-t":
|
||||
last_cmd = "--target";
|
||||
continue;
|
||||
default:
|
||||
throw new RuntimeException("Unknown command " + arg);
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ class Config {
|
||||
public static final String APP_APPVER = "0.1";
|
||||
public static final String APP_LANG = "en";
|
||||
|
||||
public static final String FILE_BASE = "data";
|
||||
public static String FILE_BASE = System.getProperty("user.home") + File.separatorChar + ".telegram_backup";
|
||||
public static final String FILE_NAME_AUTH_KEY = "auth.dat";
|
||||
public static final String FILE_NAME_DC = "dc.dat";
|
||||
public static final String FILE_NAME_DB = "database.sqlite";
|
||||
|
Loading…
Reference in New Issue
Block a user