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
{
15 public RemoveDeviceCommand(final OutputWriter outputWriter
) {
18 public static void attachToSubparser(final Subparser subparser
) {
19 subparser
.help("Remove a linked device.");
20 subparser
.addArgument("-d", "--device-id", "--deviceId")
23 .help("Specify the device you want to remove. Use listDevices to see the deviceIds.");
27 public void handleCommand(final Namespace ns
, final Manager m
) throws CommandException
{
29 int deviceId
= ns
.getInt("device-id");
30 m
.removeLinkedDevices(deviceId
);
31 } catch (IOException e
) {
32 throw new IOErrorException("Error while removing device: " + e
.getMessage());