]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/ReceiveCommand.java
Improve command line help
[signal-cli] / src / main / java / org / asamk / signal / commands / ReceiveCommand.java
index a03fc130d3889505a3769d74664f09f017825b9c..acb3a66289b2d4c0ac929e7863eab84cacd7e1f1 100644 (file)
@@ -33,8 +33,10 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
 
     @Override
     public void attachToSubparser(final Subparser subparser) {
+        subparser.help("Query the server for new messages.");
         subparser.addArgument("-t", "--timeout")
                 .type(double.class)
+                .setDefault(3.0)
                 .help("Number of seconds to wait for new messages (negative values disable timeout)");
         subparser.addArgument("--ignore-attachments")
                 .help("Don’t download attachments of received messages.")
@@ -148,16 +150,13 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
             logger.warn("\"--json\" option has been deprecated, please use the global \"--output=json\" instead.");
         }
 
-        double timeout = 5;
-        if (ns.getDouble("timeout") != null) {
-            timeout = ns.getDouble("timeout");
-        }
+        double timeout = ns.getDouble("timeout");
         var returnOnTimeout = true;
         if (timeout < 0) {
             returnOnTimeout = false;
             timeout = 3600;
         }
-        boolean ignoreAttachments = ns.getBoolean("ignore_attachments");
+        boolean ignoreAttachments = ns.getBoolean("ignore-attachments");
         try {
             final var handler = inJson ? new JsonReceiveMessageHandler(m) : new ReceiveMessageHandler(m);
             m.receiveMessages((long) (timeout * 1000),