Skip to content

Commit

Permalink
fix(cli): fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Red-Asuka authored and ysfscream committed Apr 28, 2023
1 parent 42f2e89 commit 2b4ad4c
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions cli/README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ mqttx conn --help
| --ca | ca 证书的文件路径 |
| --insecure | 取消服务器的证书校验 |
| -rp, --reconnect-period <MILLISECONDS> | 自动重连的间隔时间,通过设置为 0 来禁用自动重连,默认为 1000ms |
| --maximun-reconnect-times <NUMBER> | 最大重连次数,默认为 10 |
| --maximum-reconnect-times <NUMBER> | 最大重连次数,默认为 10 |
| -up, --user-properties <USERPROPERTIES...> | MQTT 5.0 用户属性,例如:-up "name: mqttx cli" |
| -Wt, --will-topic <TOPIC> | 遗嘱消息的 Topic |
| -Wm, --will-message <BODY> | 遗嘱消息的 Payload |
Expand Down Expand Up @@ -226,7 +226,7 @@ mqttx sub --help
| --ca | ca 证书的文件路径 |
| --insecure | 取消服务器的证书校验 |
| -rp, --reconnect-period <MILLISECONDS> | 自动重连的间隔时间,通过设置为 0 来禁用自动重连,默认为 1000ms |
| --maximun-reconnect-times <NUMBER> | 最大重连次数,默认为 10 |
| --maximum-reconnect-times <NUMBER> | 最大重连次数,默认为 10 |
| -up, --user-properties <USERPROPERTIES...> | MQTT 5.0 用户属性,例如:-up "name: mqttx cli" |
| -f, --format <TYPE> | 消息格式化类型,支持 base64、json、hex |
| -v, --verbose | 在接收到的 Payload 前显示当前 Topic |
Expand Down Expand Up @@ -281,7 +281,7 @@ mqttx pub --help
| --ca | ca 证书的文件路径 |
| --insecure | 取消服务器的证书校验 |
| -rp, --reconnect-period <MILLISECONDS> | 自动重连的间隔时间,通过设置为 0 来禁用自动重连,默认为 1000ms |
| --maximun-reconnect-times <NUMBER> | 最大重连次数,默认为 10 |
| --maximum-reconnect-times <NUMBER> | 最大重连次数,默认为 10 |
| -up, --user-properties <USERPROPERTIES...> | MQTT 5.0 用户属性,例如:-up "name: mqttx cli" |
| -pf, --payload-format-indicator | 发布信息的有效载荷格式指标 |
| -e, --message-expiry-interval <NUMBER> | 发布信息的有效期,单位为秒 |
Expand Down
6 changes: 3 additions & 3 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ mqttx conn --help
| --ca <PATH> | path to the ca certificate |
| --insecure | do not verify the server certificate |
| -rp, --reconnect-period <MILLISECONDS> | interval between two reconnections, disable auto reconnect by setting to 0 (default: 1000ms) |
| --maximun-reconnect-times <NUMBER> | the maximum reconnect times (default: 10) |
| --maximum-reconnect-times <NUMBER> | the maximum reconnect times (default: 10) |
| -up, --user-properties <USERPROPERTIES...> | the user properties of MQTT 5.0 (e.g. -up "name: mqttx cli") |
| -Wt, --will-topic <TOPIC> | the will topic |
| -Wm, --will-message <BODY> | the will message |
Expand Down Expand Up @@ -225,7 +225,7 @@ mqttx sub --help
| --ca | path to the ca certificate |
| --insecure | do not verify the server certificate |
| -rp, --reconnect-period <MILLISECONDS> | interval between two reconnections, disable auto reconnect by setting to 0 (default: 1000ms) |
| --maximun-reconnect-times <NUMBER> | the maximum reconnect times (default: 10) |
| --maximum-reconnect-times <NUMBER> | the maximum reconnect times (default: 10) |
| -up, --user-properties <USERPROPERTIES...> | the user properties of MQTT 5.0 (e.g. -up "name: mqttx cli") |
| -f, --format <TYPE> | format the message body, support base64, json, hex |
| -v, --verbose | print the topic before the message |
Expand Down Expand Up @@ -280,7 +280,7 @@ mqttx pub --help
| --ca | path to the ca certificate |
| --insecure | do not verify the server certificate |
| -rp, --reconnect-period <MILLISECONDS> | interval between two reconnections, disable auto reconnect by setting to 0 (default: 1000ms) |
| --maximun-reconnect-times <NUMBER> | the maximum reconnect times (default: 10) |
| --maximum-reconnect-times <NUMBER> | the maximum reconnect times (default: 10) |
| -up, --user-properties <USERPROPERTIES...> | 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 <NUMBER> | the lifetime of the publish message in seconds |
Expand Down
12 changes: 6 additions & 6 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class Commander {
parseNumber,
1000,
)
.option('--maximun-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
.option('--maximum-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
// properties options of MQTT 5.0
.option('-se, --session-expiry-interval <SECONDS>', 'the session expiry interval in seconds', parseNumber)
.option('--rcv-max, --receive-maximum <NUMBER>', 'the receive maximum value', parseNumber)
Expand Down Expand Up @@ -151,7 +151,7 @@ export class Commander {
parseNumber,
1000,
)
.option('--maximun-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
.option('--maximum-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
// connect properties options of MQTT 5.0
.option('-se, --session-expiry-interval <SECONDS>', 'the session expiry interval in seconds', parseNumber)
.option('--rcv-max, --receive-maximum <NUMBER>', 'the receive maximum value', parseNumber)
Expand Down Expand Up @@ -238,7 +238,7 @@ export class Commander {
parseNumber,
1000,
)
.option('--maximun-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
.option('--maximum-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
// connect properties options of MQTT 5.0
.option('-se, --session-expiry-interval <SECONDS>', 'the session expiry interval in seconds', parseNumber)
.option('--rcv-max, --receive-maximum <NUMBER>', 'the receive maximum value', parseNumber)
Expand Down Expand Up @@ -304,7 +304,7 @@ export class Commander {
parseNumber,
1000,
)
.option('--maximun-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
.option('--maximum-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
// properties options of MQTT 5.0
.option('-se, --session-expiry-interval <SECONDS>', 'the session expiry interval in seconds', parseNumber)
.option('--rcv-max, --receive-maximum <NUMBER>', 'the receive maximum value', parseNumber)
Expand Down Expand Up @@ -400,7 +400,7 @@ export class Commander {
parseNumber,
1000,
)
.option('--maximun-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
.option('--maximum-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
// connect properties options of MQTT 5.0
.option('-se, --session-expiry-interval <SECONDS>', 'the session expiry interval in seconds', parseNumber)
.option('--rcv-max, --receive-maximum <NUMBER>', 'the receive maximum value', parseNumber)
Expand Down Expand Up @@ -485,7 +485,7 @@ export class Commander {
parseNumber,
1000,
)
.option('--maximun-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
.option('--maximum-reconnect-times <NUMBER>', 'the maximum reconnect times', parseNumber, 10)
// connect properties options of MQTT 5.0
.option('-se, --session-expiry-interval <SECONDS>', 'the session expiry interval in seconds', parseNumber)
.option('--rcv-max, --receive-maximum <NUMBER>', 'the receive maximum value', parseNumber)
Expand Down
8 changes: 4 additions & 4 deletions cli/src/lib/conn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const conn = (options: ConnectOptions) => {

save && saveConfig('conn', options)

const { maximunReconnectTimes } = options
const { maximumReconnectTimes } = options

const connOpts = parseConnectOptions(options, 'conn')

Expand All @@ -33,7 +33,7 @@ const conn = (options: ConnectOptions) => {

client.on('reconnect', () => {
retryTimes += 1
if (retryTimes > maximunReconnectTimes) {
if (retryTimes > maximumReconnectTimes) {
client.end(false, {}, () => {
basicLog.reconnectTimesLimit()
})
Expand All @@ -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')

Expand Down Expand Up @@ -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!)
})
Expand Down
12 changes: 6 additions & 6 deletions cli/src/lib/pub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) => {
Expand All @@ -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')

Expand Down Expand Up @@ -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)
}
})
Expand Down
10 changes: 5 additions & 5 deletions cli/src/lib/sub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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()
})
Expand All @@ -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')

Expand Down Expand Up @@ -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)
}
})
Expand Down
2 changes: 1 addition & 1 deletion cli/src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2b4ad4c

Please sign in to comment.