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): remove ws, wss of protocol option #1073

Merged
merged 2 commits into from
Sep 19, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cli/README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ mqttx conn --help
| -k, --keepalive <SEC> | MQTT 的 Keep Alive,默认为 30 |
| -u, --username <USER> | 连接到 MQTT Broker 的用户名 |
| -P, --password <PASS> | 连接到 MQTT Broker 的密码 |
| -l, --protocol <PROTO> | 连接时的协议,mqtt, mqtts, ws or wss |
| -l, --protocol <PROTO> | 连接时的协议,mqttmqtts,默认为 mqtt |
| --key <PATH> | key 文件的路径 |
| --cert <PATH> | cert 文件的路径 |
| --ca | ca 证书的文件路径 |
Expand Down Expand Up @@ -181,7 +181,7 @@ mqttx sub --help
| -k, --keepalive <SEC> | MQTT 的 Keep Alive,默认为 30 |
| -u, --username <USER> | 连接到 MQTT Broker 的用户名 |
| -P, --password <PASS> | 连接到 MQTT Broker 的密码 |
| -l, --protocol <PROTO> | 连接时的协议,mqtt, mqtts, ws or wss |
| -l, --protocol <PROTO> | 连接时的协议,mqttmqtts,默认为 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 标识 |
Expand Down Expand Up @@ -217,7 +217,7 @@ mqttx pub --help
| -M, --multiline | 可以通过多行发布多条消息 |
| -u, --username <USER> | 连接到 MQTT Broker 的用户名 |
| -P, --password <PASS> | 连接到 MQTT Broker 的密码 |
| -l, --protocol <PROTO> | 连接时的协议,mqtt, mqtts, ws or wss |
| -l, --protocol <PROTO> | 连接时的协议,mqttmqtts,默认为 mqtt |
| --key <PATH> | key 文件的路径 |
| --cert <PATH> | cert 文件的路径 |
| --ca | ca 证书的文件路径 |
Expand Down
6 changes: 3 additions & 3 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ mqttx conn --help
| -k, --keepalive <SEC> | send a ping every SEC seconds (default: 30) |
| -u, --username <USER> | the username |
| -P, --password <PASS> | the password |
| -l, --protocol <PROTO> | the protocol to use, mqtt, mqtts, ws or wss |
| -l, --protocol <PROTO> | the protocol to use, mqtt or mqtts (default: mqtt) |
| --key <PATH> | path to the key file |
| --cert <PATH> | path to the cert file |
| --ca <PATH> | path to the ca certificate |
Expand Down Expand Up @@ -180,7 +180,7 @@ mqttx sub --help
| -k, --keepalive <SEC> | send a ping every SEC seconds (default: 30) |
| -u, --username <USER> | the username |
| -P, --password <PASS> | the password |
| -l, --protocol <PROTO> | the protocol to use, mqtt, mqtts, ws or wss |
| -l, --protocol <PROTO> | 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 |
Expand Down Expand Up @@ -216,7 +216,7 @@ mqttx pub --help
| -M, --multiline | read lines from stdin as multiple messages |
| -u, --username <USER> | the username |
| -P, --password <PASS> | the password |
| -l, --protocol <PROTO> | the protocol to use, mqtt, mqtts, ws or wss |
| -l, --protocol <PROTO> | the protocol to use, mqtt or mqtts (default: mqtt) |
| --key <PATH> | path to the key file |
| --cert <PATH> | path to the cert file |
| --ca | path to the ca certificate |
Expand Down
6 changes: 3 additions & 3 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class Commander {
.option('-k, --keepalive <SEC>', 'send a ping every SEC seconds', parseNumber, 30)
.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws or wss', parseProtocol)
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt or mqtts (default: mqtt)', parseProtocol)
.option('--key <PATH>', 'path to the key file')
.option('--cert <PATH>', 'path to the cert file')
.option('--ca <PATH>', 'path to the ca certificate')
Expand Down Expand Up @@ -69,7 +69,7 @@ export class Commander {
.option('-M, --multiline', 'read lines from stdin as multiple messages')
.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws or wss', parseProtocol)
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt or mqtts (default: mqtt)', parseProtocol)
.option('--key <PATH>', 'path to the key file')
.option('--cert <PATH>', 'path to the cert file')
.option('--ca <PATH>', 'path to the ca certificate')
Expand Down Expand Up @@ -98,7 +98,7 @@ export class Commander {
.option('-k, --keepalive <SEC>', 'send a ping every SEC seconds', parseNumber, 30)
.option('-u, --username <USER>', 'the username')
.option('-P, --password <PASS>', 'the password')
.option('-l, --protocol <PROTO>', 'the protocol to use, mqtt, mqtts, ws or wss', parseProtocol)
.option('-l, --protocol <PROTO>', '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...]',
Expand Down
4 changes: 2 additions & 2 deletions cli/src/utils/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ const parseNumber = (value: string) => {
}

const parseProtocol = (value: string) => {
if (!['mqtt', 'mqtts', 'ws', 'wss'].includes(value)) {
program.error('Not mqtt, mqtts, ws or wss.')
if (!['mqtt', 'mqtts'].includes(value)) {
program.error('Only mqtt and mqtts are supported.')
}
return value
}
Expand Down