]> nmode's Git Repositories - signal-cli/commitdiff
Refactor UpdateContactCommand
authorAsamK <asamk@gmx.de>
Wed, 16 Oct 2019 17:26:52 +0000 (19:26 +0200)
committerAsamK <asamk@gmx.de>
Wed, 16 Oct 2019 17:27:51 +0000 (19:27 +0200)
man/signal-cli.1.adoc
src/main/java/org/asamk/signal/commands/Commands.java
src/main/java/org/asamk/signal/commands/SendContactsCommand.java
src/main/java/org/asamk/signal/commands/UpdateContactCommand.java [moved from src/main/java/org/asamk/signal/commands/SetContactNameCommand.java with 78% similarity]

index 2d91826be49a7ffa2a8ed1f81db18a337cb02c26..2f1b2ac294f3afb10327f4c9f6331f774a8ec031 100644 (file)
@@ -223,16 +223,24 @@ with every outgoing messages (excluding group messages).
 *--remove-avatar*::
        Remove the avatar visible by message recipients.
 
-setContactName
+updateContact
 --------------
-Update name associated to a number on our contact list. This change is only local but can be synchronized to other devices by using `sendContacts` (see below).
-number::
+Update the info associated to a number on our contact list. This change is only
+local but can be synchronized to other devices by using `sendContacts` (see
+below).
+If the contact doesn't exist yet, it will be added.
+
+NUMBER::
        Specify the contact phone number.
-name::
+
+*-n*, *--name*::
        Specify the new name for this contact.
+
 sendContacts
 ------------
-Update contact list on Signal servers.
+Send a synchronization message with the local contacts list to all linked devices.
+This command should only be used if this is the master device.
+
 daemon
 ~~~~~~
 signal-cli can run in daemon mode and provides an experimental dbus interface. For
index ed2796b82fdfb5897021ccc1c89528461ce7ad9e..afd93e320ba188c37b08f5b305150215f50353eb 100644 (file)
@@ -21,7 +21,7 @@ public class Commands {
         addCommand("removePin", new RemovePinCommand());
         addCommand("send", new SendCommand());
         addCommand("sendContacts", new SendContactsCommand());
-        addCommand("setContactName", new SetContactNameCommand());
+        addCommand("updateContact", new UpdateContactCommand());
         addCommand("setPin", new SetPinCommand());
         addCommand("trust", new TrustCommand());
         addCommand("unregister", new UnregisterCommand());
index 15241a34c0033c07e3e51c427b2f51b838b783ee..523292abdf76a121576fd36b2122e61c5ef6581c 100644 (file)
@@ -11,7 +11,7 @@ public class SendContactsCommand implements LocalCommand {
 
     @Override
     public void attachToSubparser(final Subparser subparser) {
-        subparser.help("Send contacts to the signal server.");
+        subparser.help("Send a synchronization message with the local contacts list to all linked devices.");
     }
 
     @Override
similarity index 78%
rename from src/main/java/org/asamk/signal/commands/SetContactNameCommand.java
rename to src/main/java/org/asamk/signal/commands/UpdateContactCommand.java
index d7cbedc650ee35f6be15688571e88696693b7004..e1afca6948f6bb69b9e95afcf1cd3b37825efcc2 100644 (file)
@@ -1,19 +1,20 @@
 package org.asamk.signal.commands;
 
-import net.sourceforge.argparse4j.impl.Arguments;
 import net.sourceforge.argparse4j.inf.Namespace;
 import net.sourceforge.argparse4j.inf.Subparser;
+
 import org.asamk.signal.manager.Manager;
 
-public class SetContactNameCommand implements LocalCommand {
+public class UpdateContactCommand implements LocalCommand {
 
     @Override
     public void attachToSubparser(final Subparser subparser) {
         subparser.addArgument("number")
                 .help("Contact number");
-        subparser.addArgument("name")
+        subparser.addArgument("-n", "--name")
+                .required(true)
                 .help("New contact name");
-        subparser.help("Set the name of a given contact");
+        subparser.help("Update the details of a given contact");
     }
 
     @Override
@@ -30,5 +31,4 @@ public class SetContactNameCommand implements LocalCommand {
 
         return 0;
     }
-
 }