Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): fix typo #1274

Merged
merged 1 commit into from Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions cli/README-CN.md
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
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
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
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
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
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
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