diff --git a/ChangeLog.txt b/ChangeLog.txt
index 7b1cd4c2..b511fb64 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -55,7 +55,7 @@ Clients:
that instance. This is useful for negating TLS options provided in a config
file, or to disable the automatic use of TLS when using port 8883.
Closes #2180.
-- Add `--watch` to mosquitto_sub which means messages will be printed on a
+- Add `-w`/`--watch` to mosquitto_sub which means messages will be printed on a
fixed line number based on the topic and order in which messages were
received. Requires ANSI escape code support in the terminal.
diff --git a/client/args.txt b/client/args.txt
index d4093317..bdb8d853 100644
--- a/client/args.txt
+++ b/client/args.txt
@@ -43,7 +43,7 @@ u - PUB,RR,SUB (username)
V - PUB,RR,SUB (version output)
v - RR,SUB (verbose)
W - SUB (timeout)
-w
+w - SUB (watch)
X
x - PUB,RR,SUB (session-expiry-interval)
Y
diff --git a/client/client_shared.c b/client/client_shared.c
index 8ed3d4d1..2ba4ec5b 100644
--- a/client/client_shared.c
+++ b/client/client_shared.c
@@ -1198,7 +1198,7 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c
}
i++;
}
- }else if(!strcmp(argv[i], "--watch")){
+ }else if(!strcmp(argv[i], "-w") || !strcmp(argv[i], "--watch")){
if(pub_or_sub != CLIENT_SUB){
goto unknown_option;
}
diff --git a/client/sub_client.c b/client/sub_client.c
index cfb87e88..a514328f 100644
--- a/client/sub_client.c
+++ b/client/sub_client.c
@@ -205,7 +205,7 @@ static void print_usage(void)
printf(" [-A bind_address] [--nodelay]\n");
#endif
printf(" [-i id] [-I id_prefix]\n");
- printf(" [-d] [-N] [--quiet] [-v] [--watch]\n");
+ printf(" [-d] [-N] [--quiet] [-v] [-w|--watch]\n");
printf(" [--will-topic [--will-payload payload] [--will-qos qos] [--will-retain]]\n");
#ifdef WITH_TLS
printf(" [--no-tls]\n");
@@ -263,6 +263,9 @@ static void print_usage(void)
#ifndef WIN32
printf(" -W : Specifies a timeout in seconds how long to process incoming MQTT messages.\n");
#endif
+ printf(" -w : messages will be printed on a fixed line number based on the topic and order in\n");
+ printf(" which topics are received. Useful for monitoring multiple topics that have\n");
+ printf(" single line payloads.\n");
printf(" -x : Set the session-expiry-interval property on the CONNECT packet. Applies to MQTT v5\n");
printf(" clients only. Set to 0-4294967294 to specify the session will expire in that many\n");
printf(" seconds after the client disconnects, or use -1, 4294967295, or ∞ for a session\n");
@@ -282,9 +285,6 @@ static void print_usage(void)
printf(" Use -T to filter out messages you do not want to be cleared.\n");
printf(" --unix : connect to a broker through a unix domain socket instead of a TCP socket,\n");
printf(" e.g. /tmp/mosquitto.sock\n");
- printf(" --watch : messages will be printed on a fixed line number based on the topic and order in\n");
- printf(" which topics are received. Useful for monitoring multiple topics that have\n");
- printf(" single line payloads.\n");
printf(" --will-payload : payload for the client Will, which is sent by the broker in case of\n");
printf(" unexpected disconnection. If not given and will-topic is set, a zero\n");
printf(" length message will be sent.\n");
diff --git a/man/mosquitto_sub.1.xml b/man/mosquitto_sub.1.xml
index 059b6c90..8210fa71 100644
--- a/man/mosquitto_sub.1.xml
+++ b/man/mosquitto_sub.1.xml
@@ -60,7 +60,10 @@
session-expiry-intervalsocks-url
-
+
+
+
+ topicpayload
@@ -803,6 +806,7 @@ mosquitto_sub -t 'bbc/#' -T bbc/bbc1 --remove-retained
+