From 2b4ad4c0ed563901cfa86665e06f4df04e5d03d3 Mon Sep 17 00:00:00 2001 From: Red-Asuka Date: Fri, 28 Apr 2023 17:14:12 +0800 Subject: [PATCH] fix(cli): fix typo --- cli/README-CN.md | 6 +++--- cli/README.md | 6 +++--- cli/src/index.ts | 12 ++++++------ cli/src/lib/conn.ts | 8 ++++---- cli/src/lib/pub.ts | 12 ++++++------ cli/src/lib/sub.ts | 10 +++++----- cli/src/types/global.d.ts | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/cli/README-CN.md b/cli/README-CN.md index d8325006c..99d42fcf1 100644 --- a/cli/README-CN.md +++ b/cli/README-CN.md @@ -176,7 +176,7 @@ mqttx conn --help | --ca | ca 证书的文件路径 | | --insecure | 取消服务器的证书校验 | | -rp, --reconnect-period | 自动重连的间隔时间,通过设置为 0 来禁用自动重连,默认为 1000ms | -| --maximun-reconnect-times | 最大重连次数,默认为 10 | +| --maximum-reconnect-times | 最大重连次数,默认为 10 | | -up, --user-properties | MQTT 5.0 用户属性,例如:-up "name: mqttx cli" | | -Wt, --will-topic | 遗嘱消息的 Topic | | -Wm, --will-message | 遗嘱消息的 Payload | @@ -226,7 +226,7 @@ mqttx sub --help | --ca | ca 证书的文件路径 | | --insecure | 取消服务器的证书校验 | | -rp, --reconnect-period | 自动重连的间隔时间,通过设置为 0 来禁用自动重连,默认为 1000ms | -| --maximun-reconnect-times | 最大重连次数,默认为 10 | +| --maximum-reconnect-times | 最大重连次数,默认为 10 | | -up, --user-properties | MQTT 5.0 用户属性,例如:-up "name: mqttx cli" | | -f, --format | 消息格式化类型,支持 base64、json、hex | | -v, --verbose | 在接收到的 Payload 前显示当前 Topic | @@ -281,7 +281,7 @@ mqttx pub --help | --ca | ca 证书的文件路径 | | --insecure | 取消服务器的证书校验 | | -rp, --reconnect-period | 自动重连的间隔时间,通过设置为 0 来禁用自动重连,默认为 1000ms | -| --maximun-reconnect-times | 最大重连次数,默认为 10 | +| --maximum-reconnect-times | 最大重连次数,默认为 10 | | -up, --user-properties | MQTT 5.0 用户属性,例如:-up "name: mqttx cli" | | -pf, --payload-format-indicator | 发布信息的有效载荷格式指标 | | -e, --message-expiry-interval | 发布信息的有效期,单位为秒 | diff --git a/cli/README.md b/cli/README.md index 472c74006..e60091ac4 100644 --- a/cli/README.md +++ b/cli/README.md @@ -175,7 +175,7 @@ mqttx conn --help | --ca | path to the ca certificate | | --insecure | do not verify the server certificate | | -rp, --reconnect-period | interval between two reconnections, disable auto reconnect by setting to 0 (default: 1000ms) | -| --maximun-reconnect-times | the maximum reconnect times (default: 10) | +| --maximum-reconnect-times | the maximum reconnect times (default: 10) | | -up, --user-properties | the user properties of MQTT 5.0 (e.g. -up "name: mqttx cli") | | -Wt, --will-topic | the will topic | | -Wm, --will-message | the will message | @@ -225,7 +225,7 @@ mqttx sub --help | --ca | path to the ca certificate | | --insecure | do not verify the server certificate | | -rp, --reconnect-period | interval between two reconnections, disable auto reconnect by setting to 0 (default: 1000ms) | -| --maximun-reconnect-times | the maximum reconnect times (default: 10) | +| --maximum-reconnect-times | the maximum reconnect times (default: 10) | | -up, --user-properties | the user properties of MQTT 5.0 (e.g. -up "name: mqttx cli") | | -f, --format | format the message body, support base64, json, hex | | -v, --verbose | print the topic before the message | @@ -280,7 +280,7 @@ mqttx pub --help | --ca | path to the ca certificate | | --insecure | do not verify the server certificate | | -rp, --reconnect-period | interval between two reconnections, disable auto reconnect by setting to 0 (default: 1000ms) | -| --maximun-reconnect-times | the maximum reconnect times (default: 10) | +| --maximum-reconnect-times | the maximum reconnect times (default: 10) | | -up, --user-properties | the user properties of MQTT 5.0 (e.g. -up "name: mqttx cli") | | -pf, --payload-format-indicator | the payload format indicator of the publish message | | -e, --message-expiry-interval | the lifetime of the publish message in seconds | diff --git a/cli/src/index.ts b/cli/src/index.ts index 93e7f4f2a..ffce251b2 100755 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -61,7 +61,7 @@ export class Commander { parseNumber, 1000, ) - .option('--maximun-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) + .option('--maximum-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) // properties options of MQTT 5.0 .option('-se, --session-expiry-interval ', 'the session expiry interval in seconds', parseNumber) .option('--rcv-max, --receive-maximum ', 'the receive maximum value', parseNumber) @@ -151,7 +151,7 @@ export class Commander { parseNumber, 1000, ) - .option('--maximun-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) + .option('--maximum-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) // connect properties options of MQTT 5.0 .option('-se, --session-expiry-interval ', 'the session expiry interval in seconds', parseNumber) .option('--rcv-max, --receive-maximum ', 'the receive maximum value', parseNumber) @@ -238,7 +238,7 @@ export class Commander { parseNumber, 1000, ) - .option('--maximun-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) + .option('--maximum-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) // connect properties options of MQTT 5.0 .option('-se, --session-expiry-interval ', 'the session expiry interval in seconds', parseNumber) .option('--rcv-max, --receive-maximum ', 'the receive maximum value', parseNumber) @@ -304,7 +304,7 @@ export class Commander { parseNumber, 1000, ) - .option('--maximun-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) + .option('--maximum-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) // properties options of MQTT 5.0 .option('-se, --session-expiry-interval ', 'the session expiry interval in seconds', parseNumber) .option('--rcv-max, --receive-maximum ', 'the receive maximum value', parseNumber) @@ -400,7 +400,7 @@ export class Commander { parseNumber, 1000, ) - .option('--maximun-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) + .option('--maximum-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) // connect properties options of MQTT 5.0 .option('-se, --session-expiry-interval ', 'the session expiry interval in seconds', parseNumber) .option('--rcv-max, --receive-maximum ', 'the receive maximum value', parseNumber) @@ -485,7 +485,7 @@ export class Commander { parseNumber, 1000, ) - .option('--maximun-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) + .option('--maximum-reconnect-times ', 'the maximum reconnect times', parseNumber, 10) // connect properties options of MQTT 5.0 .option('-se, --session-expiry-interval ', 'the session expiry interval in seconds', parseNumber) .option('--rcv-max, --receive-maximum ', 'the receive maximum value', parseNumber) diff --git a/cli/src/lib/conn.ts b/cli/src/lib/conn.ts index 19622529a..b1dea5f81 100644 --- a/cli/src/lib/conn.ts +++ b/cli/src/lib/conn.ts @@ -11,7 +11,7 @@ const conn = (options: ConnectOptions) => { save && saveConfig('conn', options) - const { maximunReconnectTimes } = options + const { maximumReconnectTimes } = options const connOpts = parseConnectOptions(options, 'conn') @@ -33,7 +33,7 @@ const conn = (options: ConnectOptions) => { client.on('reconnect', () => { retryTimes += 1 - if (retryTimes > maximunReconnectTimes) { + if (retryTimes > maximumReconnectTimes) { client.end(false, {}, () => { basicLog.reconnectTimesLimit() }) @@ -54,7 +54,7 @@ const benchConn = async (options: BenchConnectOptions) => { save && saveConfig('benchConn', options) - const { count, interval, hostname, port, clientId, maximunReconnectTimes } = options + const { count, interval, hostname, port, clientId, maximumReconnectTimes } = options const connOpts = parseConnectOptions(options, 'conn') @@ -102,7 +102,7 @@ const benchConn = async (options: BenchConnectOptions) => { client.on('reconnect', () => { retryTimesArray[i - 1] += 1 - if (retryTimesArray[i - 1] > maximunReconnectTimes) { + if (retryTimesArray[i - 1] > maximumReconnectTimes) { client.end(false, {}, () => { benchLog.reconnectTimesLimit(connectedCount, count, opts.clientId!) }) diff --git a/cli/src/lib/pub.ts b/cli/src/lib/pub.ts index 587a49f78..aeaf8c27e 100644 --- a/cli/src/lib/pub.ts +++ b/cli/src/lib/pub.ts @@ -39,7 +39,7 @@ const multisend = ( config: boolean | string | undefined, connOpts: IClientOptions, pubOpts: { topic: string; message: string | Buffer; opts: IClientPublishOptions }, - maximunReconnectTimes: number, + maximumReconnectTimes: number, ) => { let isNewConnection = true let retryTimes = 0 @@ -72,7 +72,7 @@ const multisend = ( client.on('reconnect', () => { retryTimes += 1 - if (retryTimes > maximunReconnectTimes) { + if (retryTimes > maximumReconnectTimes) { client.end(false, {}, () => { basicLog.reconnectTimesLimit() process.exit(1) @@ -106,7 +106,7 @@ const pub = (options: PublishOptions) => { if (options.stdin) { if (options.multiline) { - multisend(config, connOpts, pubOpts, options.maximunReconnectTimes) + multisend(config, connOpts, pubOpts, options.maximumReconnectTimes) } else { process.stdin.pipe( concat((data) => { @@ -127,7 +127,7 @@ const benchPub = async (options: BenchPublishOptions) => { save && saveConfig('benchPub', options) - const { count, interval, messageInterval, hostname, port, topic, clientId, verbose, maximunReconnectTimes } = options + const { count, interval, messageInterval, hostname, port, topic, clientId, verbose, maximumReconnectTimes } = options checkTopicExists(topic, 'benchPub') @@ -221,10 +221,10 @@ const benchPub = async (options: BenchPublishOptions) => { client.on('reconnect', () => { retryTimesArray[i - 1] += 1 - if (retryTimesArray[i - 1] > maximunReconnectTimes) { + if (retryTimesArray[i - 1] > maximumReconnectTimes) { client.end(false, {}, () => { benchLog.reconnectTimesLimit(connectedCount, count, opts.clientId!) - if (retryTimesArray.findIndex((times) => times <= maximunReconnectTimes) === -1) { + if (retryTimesArray.findIndex((times) => times <= maximumReconnectTimes) === -1) { process.exit(1) } }) diff --git a/cli/src/lib/sub.ts b/cli/src/lib/sub.ts index ec6e9c1f5..3b9eabafb 100644 --- a/cli/src/lib/sub.ts +++ b/cli/src/lib/sub.ts @@ -18,7 +18,7 @@ const sub = (options: SubscribeOptions) => { const client = mqtt.connect(connOpts) - const { outputMode, maximunReconnectTimes } = options + const { outputMode, maximumReconnectTimes } = options const outputModeClean = outputMode === 'clean' @@ -95,7 +95,7 @@ const sub = (options: SubscribeOptions) => { client.on('reconnect', () => { retryTimes += 1 - if (retryTimes > maximunReconnectTimes) { + if (retryTimes > maximumReconnectTimes) { client.end(false, {}, () => { !outputModeClean && basicLog.reconnectTimesLimit() }) @@ -116,7 +116,7 @@ const benchSub = async (options: BenchSubscribeOptions) => { save && saveConfig('benchSub', options) - const { count, interval, topic, hostname, port, clientId, verbose, maximunReconnectTimes } = options + const { count, interval, topic, hostname, port, clientId, verbose, maximumReconnectTimes } = options checkTopicExists(topic, 'benchSub') @@ -227,10 +227,10 @@ const benchSub = async (options: BenchSubscribeOptions) => { client.on('reconnect', () => { retryTimesArray[i - 1] += 1 - if (retryTimesArray[i - 1] > maximunReconnectTimes) { + if (retryTimesArray[i - 1] > maximumReconnectTimes) { client.end(false, {}, () => { benchLog.reconnectTimesLimit(connectedCount, count, opts.clientId!) - if (retryTimesArray.findIndex((times) => times <= maximunReconnectTimes) === -1) { + if (retryTimesArray.findIndex((times) => times <= maximumReconnectTimes) === -1) { process.exit(1) } }) diff --git a/cli/src/types/global.d.ts b/cli/src/types/global.d.ts index 7fb9110b6..6861f8c7d 100644 --- a/cli/src/types/global.d.ts +++ b/cli/src/types/global.d.ts @@ -26,7 +26,7 @@ declare global { ca?: string insecure?: boolean reconnectPeriod: number - maximunReconnectTimes: number + maximumReconnectTimes: number // properties of MQTT 5.0 sessionExpiryInterval?: number receiveMaximum?: number