Files
晴天 f42915abd1 feat: 便携模式 + Windows 版本检测
- 便携模式:程序同级目录放 portable 空文件,配置/bin/日志/PID 全部就地存储
- Windows 版本检测:启动时检测 OS 版本,低于 Win10 友好提示退出
- install 命令便携模式下拒绝注册系统服务
- reset 命令便携模式下安全清理(不删程序自身)
- pidFile 包级变量改为函数调用,消除初始化时序隐患

Closes #8
2026-02-24 22:21:17 +08:00

30 lines
524 B
Go

package cmd
import (
"fmt"
"os"
"github.com/qingchencloud/cftunnel/internal/config"
"github.com/spf13/cobra"
)
var Version = "dev"
var rootCmd = &cobra.Command{
Use: "cftunnel",
Short: "Cloudflare Tunnel 一键管理工具",
Version: Version,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
checkWindowsVersion()
if config.Portable() {
fmt.Printf("[便携模式] 数据目录: %s\n", config.Dir())
}
},
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}