Enhance error handling and user feedback in the web server's index handler

This commit is contained in:
MiaoMint
2025-09-23 02:08:09 +08:00
parent 3ce69dbe2d
commit d917b7238e
3 changed files with 82 additions and 30 deletions

View File

@@ -85,7 +85,7 @@ func main() {
}
func showUsage() {
fmt.Println(`
fmt.Print(`
🔌 NAS 端口管理器
================
@@ -97,17 +97,17 @@ func showUsage() {
选项:
-port int
Web服务器端口 (默认: 8080)
Web服务器端口 (默认: 8080)
-scan
仅扫描端口并输出结果不启动Web服务器
仅扫描端口并输出结果不启动Web服务器
-random
生成一个随机可用端口
生成一个随机可用端口
-min int
随机端口最小值 (默认: 8000)
随机端口最小值 (默认: 8000)
-max int
随机端口最大值 (默认: 9999)
随机端口最大值 (默认: 9999)
-help
显示此帮助信息
显示此帮助信息
示例:
# 启动Web界面 (默认端口8080)
@@ -134,6 +134,6 @@ func showUsage() {
✅ 响应式Web界面设计
更多信息:
项目地址: https://github.com/miaomint/port-manager
`)
项目地址: https://github.com/miaomint/port-manager`)
fmt.Println()
}