1 package org
.asamk
.signal
.commands
;
3 import net
.sourceforge
.argparse4j
.inf
.Namespace
;
4 import net
.sourceforge
.argparse4j
.inf
.Subparser
;
6 import org
.asamk
.signal
.OutputWriter
;
7 import org
.asamk
.signal
.commands
.exceptions
.CommandException
;
8 import org
.asamk
.signal
.commands
.exceptions
.IOErrorException
;
9 import org
.asamk
.signal
.manager
.Manager
;
11 import java
.io
.IOException
;
13 public class RemoveDeviceCommand
implements JsonRpcLocalCommand
{
16 public String
getName() {
17 return "removeDevice";
21 public void attachToSubparser(final Subparser subparser
) {
22 subparser
.help("Remove a linked device.");
23 subparser
.addArgument("-d", "--device-id", "--deviceId")
26 .help("Specify the device you want to remove. Use listDevices to see the deviceIds.");
30 public void handleCommand(
31 final Namespace ns
, final Manager m
, final OutputWriter outputWriter
32 ) throws CommandException
{
34 int deviceId
= ns
.getInt("device-id");
35 m
.removeLinkedDevices(deviceId
);
36 } catch (IOException e
) {
37 throw new IOErrorException("Error while removing device: " + e
.getMessage(), e
);