Skip to content

Commit 0e0e0a7

Browse files
committed
Update CLI output for nmqtt_pub
1 parent e6e7ce9 commit 0e0e0a7

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

src/nmqtt_pub.nim

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import cligen
2+
23
from os import getCurrentProcessId
34

5+
import utils/version
6+
47
include "nmqtt.nim"
58

69

@@ -56,24 +59,25 @@ proc nmqttPub(host="127.0.0.1", port=1883, ssl=false, clientid="", username="",
5659

5760
when isMainModule:
5861

59-
let topLvlUse = """${doc}
62+
let topLvlUse = """nmqtt_pub is a MQTT client for publishing messages to a MQTT-broker.
63+
nmqtt_pub is based upon nmqtt version """ & nmqttVersion & """
64+
65+
6066
Usage:
6167
$command [options] -t {topic} -m {message}
6268
$command [-h host -p port -u username -P password] -t {topic} -m {message}
6369
6470
OPTIONS
6571
$options
6672
"""
67-
#clCfg.hTabCols = @[clOptKeys, clDflVal, clDescrip]
6873
clCfg.hTabCols = @[clOptKeys, clDescrip]
69-
dispatch(nmqttPub,
70-
doc="Publish MQTT messages to a MQTT-broker.",
74+
dispatchGen(nmqttPub,
7175
cmdName="nmqtt_pub",
7276
help={
7377
"host": "IP-address of the broker.",
7478
"port": "network port to connect too.",
75-
"ssl": "enable ssl. Auto-enabled on port 8883.",
76-
"clientid": "your connection ID. Defaults to nmqtt_pub_ appended with processID.",
79+
"ssl": "use ssl.",
80+
"clientid": "your connection ID. Defaults to nmqttpub- appended with processID.",
7781
"username": "provide a username",
7882
"password": "provide a password",
7983
"topic": "mqtt topic to publish to.",
@@ -85,7 +89,8 @@ $options
8589
"willtopic": "set the will's topic",
8690
"willmsg": "set the will's message",
8791
"willqos": "set the will's quality of service",
88-
"willretain": "set to retain the will message"
92+
"willretain": "set to retain the will message",
93+
"verbosity": "set the verbosity level from 0-2. Defaults to 0."
8994
},
9095
short={
9196
"password": 'P',
@@ -96,5 +101,8 @@ $options
96101
"willqos": '\0',
97102
"willretain": '\0'
98103
},
99-
usage=topLvlUse
100-
)
104+
usage=topLvlUse,
105+
dispatchName="publisher"
106+
)
107+
108+
cligenQuit publisher(skipHelp=true)

0 commit comments

Comments
 (0)