Skip to content

Commit

Permalink
更新版本号,增加显示版本号的参数
Browse files Browse the repository at this point in the history
  • Loading branch information
kagurazakayashi committed Jul 18, 2022
1 parent 64bd6e8 commit 98492bc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Command: mqtt-test-server `< -l .. | -p .. | -c .. | -t .. | -w .. | -m .. | -s
- Save log to txt/log file
- `-n`
- Use a monochrome color scheme
- `-v`
- Print version info

## Build

Expand Down Expand Up @@ -77,6 +79,8 @@ Build all platforms under Windows: `build.bat`
- 将日志输出保存到某个 .txt / .log 文件
- `-n`
- 使用单色模式输出,避免某些不支持彩色的终端输出乱码
- `-v`
- 显示版本号等信息并退出

## 编译

Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET name=bin\MqttClientTestTool_v1.0.0_
SET name=bin\MqttClientTestTool_v1.1.0_
DEL /Q bin\*
SET CGO_ENABLED=0
SET GOARCH=amd64
Expand Down
12 changes: 10 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ var (
func main() {
go http.ListenAndServe(":9999", nil)
var (
version string = "1.1.0"
versionView bool = false
listen string
onlyID string
onlyTopic string
Expand All @@ -49,7 +51,8 @@ func main() {
onlyPayloadS []string = []string{}
)
// 初始化启动参数
logPrint("i", lang("TITLE")+" v1.0.1")
logPrint("i", lang("TITLE")+" v"+version)
flag.BoolVar(&versionView, "v", false, "Print version info")
flag.StringVar(&language, "l", "en", "Language ( en(default) | cn )")
flag.StringVar(&listen, "p", "127.0.0.1:1883", "Define listening on IP:Port (default: 127.0.0.1:1883 )")
flag.StringVar(&onlyID, "c", "", "Only allow these client IDs (comma separated)")
Expand All @@ -58,9 +61,14 @@ func main() {
flag.StringVar(&logData, "m", "", "Log message to csv file")
flag.StringVar(&logStatus, "s", "", "Log state changes to a csv file")
flag.StringVar(&logFile, "o", "", "Save log to txt/log file")
flag.BoolVar(&monochrome, "n", false, "monochrome")
flag.BoolVar(&monochrome, "n", false, "Use a monochrome color scheme")
flag.Parse()
// 初始化设置
if versionView {
logPrint("i", "KagurazakaYashi@Tongdy, 2022")
logPrint("i", "https://github.com/tongdysoft/mqtt-test-server")
return
}
if len(onlyID) > 0 {
onlyIdS = strings.Split(onlyID, ",")
logPrint("C", fmt.Sprintf("%s%s: %s", lang("ONLY"), lang("CLIENT"), onlyIdS))
Expand Down

0 comments on commit 98492bc

Please sign in to comment.