]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/AddDeviceCommand.java
Refactor command creation
[signal-cli] / src / main / java / org / asamk / signal / commands / AddDeviceCommand.java
index 31b3c7ef66671215e2017cc2d32a16e39da7a2ff..1616a01ff1f01a828d492409c33a1d1a290a2722 100644 (file)
@@ -21,18 +21,23 @@ public class AddDeviceCommand implements JsonRpcLocalCommand {
 
     private final static Logger logger = LoggerFactory.getLogger(AddDeviceCommand.class);
 
-    public static void attachToSubparser(final Subparser subparser) {
+    @Override
+    public String getName() {
+        return "addDevice";
+    }
+
+    @Override
+    public void attachToSubparser(final Subparser subparser) {
         subparser.help("Link another device to this device. Only works, if this is the master device.");
         subparser.addArgument("--uri")
                 .required(true)
                 .help("Specify the uri contained in the QR code shown by the new device.");
     }
 
-    public AddDeviceCommand(final OutputWriter outputWriter) {
-    }
-
     @Override
-    public void handleCommand(final Namespace ns, final Manager m) throws CommandException {
+    public void handleCommand(
+            final Namespace ns, final Manager m, final OutputWriter outputWriter
+    ) throws CommandException {
         try {
             m.addDeviceLink(new URI(ns.getString("uri")));
         } catch (IOException e) {