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

docs(cli): update ls command #1294

Merged
merged 1 commit into from
May 17, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 38 additions & 5 deletions cli/README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ mqttx simulate -sc tesla -c 10

# Specify a scenario file and start the simulation
mqttx simulate -f <scenario file path> -c 10

# List the built-in scenarios
mqttx ls -sc
```

### 参数介绍
Expand All @@ -165,7 +168,7 @@ mqttx --help
| bench | MQTT 性能测试 |
| simulate | MQTT 模拟器 |

#### 连接
### 连接

```shell
mqttx conn --help
Expand Down Expand Up @@ -210,7 +213,7 @@ mqttx conn --help
| --config \[PATH\] | 从本地配置文件加载参数,文件支持 json 和 yaml 格式,默认路径为 ./mqttx-cli-config.json |
| --help | 展示 conn 命令的帮助信息 |

#### 订阅
### 订阅

```shell
mqttx sub --help
Expand Down Expand Up @@ -265,7 +268,7 @@ mqttx sub --help
| --config \[PATH\] | 从本地配置文件加载参数,文件支持 json 和 yaml 格式,默认路径为 ./mqttx-cli-config.json |
| --help | 展示 sub 命令的帮助信息 |

#### 发布
### 发布

```shell
mqttx pub --help
Expand Down Expand Up @@ -325,7 +328,7 @@ mqttx pub --help

### 性能测试

性能测试命令与普通命令参数基本相同,以下仅列出新增或有变化的参数
性能测试命令与普通命令参数基本相同,以下仅列出新增或有变化的参数

#### 连接性能测试

Expand Down Expand Up @@ -374,7 +377,7 @@ mqttx bench pub --help

用于模拟特定场景下 MQTT 发布消息操作。

模拟器命令与[发布性能测试](#发布性能测试)参数基本相同,以下仅列出新增或有变化的参数
模拟器命令与[发布性能测试](#发布性能测试)参数基本相同,以下仅列出新增或有变化的参数

```shell
mqttx simulate --help
Expand Down Expand Up @@ -417,6 +420,36 @@ module.exports = {

对于更多示例和详细的编辑指南,请参考 MQTTX GitHub 仓库中的[脚本示例](https://github.com/emqx/MQTTX/tree/main/scripts-example/IoT-data-scenarios),或查看如何使用 [faker.js](https://fakerjs.dev/) 来生成各种类型的随机数据。

### 列表

`list` 命令提供了可用资源的概览。

> 目前,该命令仅支持列出内置的场景。

```shell
mqttx list --help
```

| 参数 | 描述 |
| ----------------------------- | -------------------------------- |
| -sc, --scenarios | 列出内置的场景 |

#### 内置场景

可以使用 `--scenarios` 选项来显示内置场景的列表。

```shell
mqttx list --scenarios
```

这个命令会输出一个表格,显示每个内置场景的名称和描述。如果想在模拟命令中使用其中一个,只需在 `--scenario` 选项中指定场景名称:

```shell
mqttx simulate --scenario <SCENARIO>
```

未来,`list` 命令将添加更多选项和功能。敬请期待!

## 与 EMQX 更好的合作

MQTTX 为连接测试 EMQX 等 MQTT 消息服务器而生,一键式的连接方式和简洁的图形界面可以帮助您快速连接到 EMQX 或 EMQX Cloud 调试并探索其功能特性。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the code review!

The code looks good and well written. I suggest to make some adjustments to your comments such as:

  • Change "参数介绍" to "参数说明"
  • Change "连接" to "连接性能测试"
  • Change "订阅" to "订阅性能测试"
  • Change "发布" to "发布性能测试"
  • Change "模拟器命令与[发布性能测试]参数基本相同" to "模拟器命令与发布性能测试的参数基本相同"
  • Add a comment to explain the purpose of the list command

Apart from these changes, the code patch looks good and is ready to be deployed!

Expand Down
39 changes: 36 additions & 3 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ mqttx simulate -sc tesla -c 10

# Specify a scenario file and start the simulation
mqttx simulate -f <scenario file path> -c 10

# List the built-in scenarios
mqttx ls -sc
```

### Help
Expand All @@ -162,7 +165,7 @@ mqttx --help
| bench | MQTT Benchmark in performance testing |
| simulate | Simulate publishing scenario-specific MQTT messages |

#### Connect
### Connect

```shell
mqttx conn --help
Expand Down Expand Up @@ -207,7 +210,7 @@ mqttx conn --help
| --config \[PATH\] | load the parameters from the local configuration file, which supports json and yaml format, default path is `./mqttx-cli-config.json` |
| --help | display help for conn command |

#### Subscribe
### Subscribe

```shell
mqttx sub --help
Expand Down Expand Up @@ -262,7 +265,7 @@ mqttx sub --help
| --config \[PATH\] | load the parameters from the local configuration file, which supports json and yaml format, default path is `./mqttx-cli-config.json` |
| --help | display help for sub command |

#### Publish
### Publish

```shell
mqttx pub --help
Expand Down Expand Up @@ -412,6 +415,36 @@ module.exports = {

For more examples and detailed editing guides, please refer to the [scripts-example](https://github.com/emqx/MQTTX/tree/main/scripts-example/IoT-data-scenarios) in the MQTTX GitHub repository, or see how to use [faker.js](https://fakerjs.dev/) to generate various types of random data.

### List

The `list` command provides an overview of available resources.

> Currently, it supports listing built-in scenarios.

```shell
mqttx list --help
```

| Options | Description |
| ----------------------------- | -------------------------------- |
| -sc, --scenarios | list the built-in scenarios |

#### Built-in Scenarios

You can use the `--scenarios` option to display a list of built-in scenarios.

```shell
mqttx list --scenarios
```

This command will output a table that shows the name and description of each built-in scenario. If you want to use one of them in the simulate command, simply specify the scenario name in the `--scenario` option:

```shell
mqttx simulate --scenario <SCENARIO>
```

More options and features will be added to the `list` command in the future. Stay tuned!

## Better Together with EMQX

MQTTX is designed to connect to test MQTT Brokers such as EMQX, The one-click connection and simple graphical interface make it easy to connect to EMQX or EMQX Cloud to debug and explore functional features.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Code review and look for potential issues with the patch.

  1. The patch looks like it is missing indentation for some of the lines and there are some redundant lines which can be removed.
  2. There are some typos in the code like 'treast' instead of 'treat'
  3. The command line options should be listed in alphabetical order.
  4. The descriptions for the commands need to be improved.
  5. The examples given for the commands should be updated.
  6. The patch should be properly tested before applying it.

Expand Down