X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/de273586b4106171a3940ce5ec2c2b3712430c8c..c6395b9f35a4229d297aef063597bc96919a7f36:/src/main/java/org/asamk/signal/commands/LinkCommand.java diff --git a/src/main/java/org/asamk/signal/commands/LinkCommand.java b/src/main/java/org/asamk/signal/commands/LinkCommand.java index 5c40dba6..fe580916 100644 --- a/src/main/java/org/asamk/signal/commands/LinkCommand.java +++ b/src/main/java/org/asamk/signal/commands/LinkCommand.java @@ -3,8 +3,11 @@ package org.asamk.signal.commands; import net.sourceforge.argparse4j.inf.Namespace; import net.sourceforge.argparse4j.inf.Subparser; +import org.asamk.signal.PlainTextWriterImpl; import org.asamk.signal.manager.ProvisioningManager; import org.asamk.signal.manager.UserAlreadyExists; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.whispersystems.libsignal.InvalidKeyException; import java.io.IOException; @@ -14,6 +17,8 @@ import static org.asamk.signal.util.ErrorUtils.handleAssertionError; public class LinkCommand implements ProvisioningCommand { + private final static Logger logger = LoggerFactory.getLogger(LinkCommand.class); + @Override public void attachToSubparser(final Subparser subparser) { subparser.addArgument("-n", "--name").help("Specify a name to describe this new device."); @@ -21,14 +26,16 @@ public class LinkCommand implements ProvisioningCommand { @Override public int handleCommand(final Namespace ns, final ProvisioningManager m) { + final var writer = new PlainTextWriterImpl(System.out); + var deviceName = ns.getString("name"); if (deviceName == null) { deviceName = "cli"; } try { - System.out.println(m.getDeviceLinkUri()); + writer.println("{}", m.getDeviceLinkUri()); var username = m.finishDeviceLink(deviceName); - System.out.println("Associated with: " + username); + writer.println("Associated with: {}", username); } catch (TimeoutException e) { System.err.println("Link request timed out, please try again."); return 3;