From bbd7841955d34499042cb9f63516e3bfb2478270 Mon Sep 17 00:00:00 2001 From: Red-Asuka Date: Mon, 19 Sep 2022 09:38:58 +0800 Subject: [PATCH] docs(cli): modify cli readme --- cli/README-CN.md | 6 +++--- cli/README.md | 6 +++--- cli/src/index.ts | 6 +++--- cli/src/utils/parse.ts | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cli/README-CN.md b/cli/README-CN.md index f1dcc8ad7..e7e176752 100644 --- a/cli/README-CN.md +++ b/cli/README-CN.md @@ -151,7 +151,7 @@ mqttx conn --help | -k, --keepalive | MQTT 的 Keep Alive,默认为 30 | | -u, --username | 连接到 MQTT Broker 的用户名 | | -P, --password | 连接到 MQTT Broker 的密码 | -| -l, --protocol | 连接时的协议,mqtt 或 mqtts | +| -l, --protocol | 连接时的协议,mqtt 或 mqtts,默认为 mqtt | | --key | key 文件的路径 | | --cert | cert 文件的路径 | | --ca | ca 证书的文件路径 | @@ -181,7 +181,7 @@ mqttx sub --help | -k, --keepalive | MQTT 的 Keep Alive,默认为 30 | | -u, --username | 连接到 MQTT Broker 的用户名 | | -P, --password | 连接到 MQTT Broker 的密码 | -| -l, --protocol | 连接时的协议,mqtt 或 mqtts | +| -l, --protocol | 连接时的协议,mqtt 或 mqtts,默认为 mqtt | | -nl, --no_local | MQTT 5.0 订阅选项中的 no local 标识 | | -rap, --retain-as-published | MQTT 5.0 订阅选项中的 retain as published 标识 | | -rh, --retain-handling <0/1/2> | MQTT 5.0 订阅选项中的 retain handling 标识 | @@ -217,7 +217,7 @@ mqttx pub --help | -M, --multiline | 可以通过多行发布多条消息 | | -u, --username | 连接到 MQTT Broker 的用户名 | | -P, --password | 连接到 MQTT Broker 的密码 | -| -l, --protocol | 连接时的协议,mqtt 或 mqtts | +| -l, --protocol | 连接时的协议,mqtt 或 mqtts,默认为 mqtt | | --key | key 文件的路径 | | --cert | cert 文件的路径 | | --ca | ca 证书的文件路径 | diff --git a/cli/README.md b/cli/README.md index 07e8d8504..c6a25d8f2 100644 --- a/cli/README.md +++ b/cli/README.md @@ -150,7 +150,7 @@ mqttx conn --help | -k, --keepalive | send a ping every SEC seconds (default: 30) | | -u, --username | the username | | -P, --password | the password | -| -l, --protocol | the protocol to use, mqtt or mqtts | +| -l, --protocol | the protocol to use, mqtt or mqtts (default: mqtt) | | --key | path to the key file | | --cert | path to the cert file | | --ca | path to the ca certificate | @@ -180,7 +180,7 @@ mqttx sub --help | -k, --keepalive | send a ping every SEC seconds (default: 30) | | -u, --username | the username | | -P, --password | the password | -| -l, --protocol | the protocol to use, mqtt or mqtts | +| -l, --protocol | the protocol to use, mqtt or mqtts (default: mqtt) | | -nl, --no_local | the no local MQTT 5.0 flag | | -rap, --retain-as-published | the retain as published MQTT 5.0 flag | | -rh, --retain-handling <0/1/2> | the retain handling MQTT 5.0 | @@ -216,7 +216,7 @@ mqttx pub --help | -M, --multiline | read lines from stdin as multiple messages | | -u, --username | the username | | -P, --password | the password | -| -l, --protocol | the protocol to use, mqtt or mqtts | +| -l, --protocol | the protocol to use, mqtt or mqtts (default: mqtt) | | --key | path to the key file | | --cert | path to the cert file | | --ca | path to the ca certificate | diff --git a/cli/src/index.ts b/cli/src/index.ts index 70e8529a3..968362862 100755 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -38,7 +38,7 @@ export class Commander { .option('-k, --keepalive ', 'send a ping every SEC seconds', parseNumber, 30) .option('-u, --username ', 'the username') .option('-P, --password ', 'the password') - .option('-l, --protocol ', 'the protocol to use, mqtt or mqtts', parseProtocol) + .option('-l, --protocol ', 'the protocol to use, mqtt or mqtts (default: mqtt)', parseProtocol) .option('--key ', 'path to the key file') .option('--cert ', 'path to the cert file') .option('--ca ', 'path to the ca certificate') @@ -69,7 +69,7 @@ export class Commander { .option('-M, --multiline', 'read lines from stdin as multiple messages') .option('-u, --username ', 'the username') .option('-P, --password ', 'the password') - .option('-l, --protocol ', 'the protocol to use, mqtt or mqtts', parseProtocol) + .option('-l, --protocol ', 'the protocol to use, mqtt or mqtts (default: mqtt)', parseProtocol) .option('--key ', 'path to the key file') .option('--cert ', 'path to the cert file') .option('--ca ', 'path to the ca certificate') @@ -98,7 +98,7 @@ export class Commander { .option('-k, --keepalive ', 'send a ping every SEC seconds', parseNumber, 30) .option('-u, --username ', 'the username') .option('-P, --password ', 'the password') - .option('-l, --protocol ', 'the protocol to use, mqtt or mqtts', parseProtocol) + .option('-l, --protocol ', 'the protocol to use, mqtt or mqtts (default: mqtt)', parseProtocol) .option('-nl, --no_local [FLAG...]', 'the no local MQTT 5.0 flag', parseVariadicOfBooleanType) .option( '-rap, --retain-as-published [FLAG...]', diff --git a/cli/src/utils/parse.ts b/cli/src/utils/parse.ts index da8c8b34d..113260a3f 100644 --- a/cli/src/utils/parse.ts +++ b/cli/src/utils/parse.ts @@ -12,7 +12,7 @@ const parseNumber = (value: string) => { const parseProtocol = (value: string) => { if (!['mqtt', 'mqtts'].includes(value)) { - program.error('Only support mqtt and mqtts.') + program.error('Only mqtt and mqtts are supported.') } return value }