mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +00:00
Add --delete-account argument to completely delete an account
This commit is contained in:
parent
c79860b493
commit
0091c1cf26
3 changed files with 21 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
package org.asamk.signal.commands;
|
||||
|
||||
import net.sourceforge.argparse4j.impl.Arguments;
|
||||
import net.sourceforge.argparse4j.inf.Namespace;
|
||||
import net.sourceforge.argparse4j.inf.Subparser;
|
||||
|
||||
|
@ -14,13 +15,21 @@ public class UnregisterCommand implements LocalCommand {
|
|||
@Override
|
||||
public void attachToSubparser(final Subparser subparser) {
|
||||
subparser.help("Unregister the current device from the signal server.");
|
||||
subparser.addArgument("--delete-account")
|
||||
.help("Delete account completely from server. CAUTION: Only do this if you won't use this number again!")
|
||||
.action(Arguments.storeTrue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
|
||||
try {
|
||||
m.unregister();
|
||||
if (ns.getBoolean("delete_account")) {
|
||||
m.deleteAccount();
|
||||
} else {
|
||||
m.unregister();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new IOErrorException("Unregister error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue