修改代码注释为中文

This commit is contained in:
zyj
2026-03-04 14:10:30 +08:00
parent 89d64cb117
commit 2cb4e1a87b
16 changed files with 1031 additions and 69 deletions

View File

@@ -17,7 +17,7 @@ var (
noColor bool
)
// rootCmd represents the base command
// rootCmd 根命令定义
var rootCmd = &cobra.Command{
Use: "devpack",
Short: "DevPack - 开发环境打包迁移工具",
@@ -29,7 +29,7 @@ var rootCmd = &cobra.Command{
Version: version.GetVersionString(),
}
// Execute adds all child commands to the root command and sets flags appropriately.
// Execute 将所有子命令添加到根命令并执行
func Execute() error {
return rootCmd.Execute()
}
@@ -37,14 +37,14 @@ func Execute() error {
func init() {
cobra.OnInitialize(initConfig)
// Global flags
// 全局参数
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "配置文件路径 (默认: ~/.devpack/config.yaml)")
rootCmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "详细输出")
rootCmd.PersistentFlags().BoolVarP(&quiet, "quiet", "q", false, "静默模式")
rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "info", "日志级别 (trace|debug|info|warn|error)")
rootCmd.PersistentFlags().BoolVar(&noColor, "no-color", false, "禁用彩色输出")
// Add subcommands
// 注册子命令
rootCmd.AddCommand(newInitCmd())
rootCmd.AddCommand(newScanCmd())
rootCmd.AddCommand(newCaptureCmd())
@@ -75,6 +75,6 @@ func initConfig() {
viper.SetEnvPrefix("DEVPACK")
viper.AutomaticEnv()
// Read config file (ignore error if not found)
// 读取配置文件(文件不存在时忽略错误)
_ = viper.ReadInConfig()
}