规范 migrate 输出

This commit is contained in:
Max 2022-02-09 19:35:38 +08:00
parent 385f42c88f
commit 5407525b75
3 changed files with 6 additions and 4 deletions

View file

@ -21,7 +21,7 @@ var migrateCmd = &cobra.Command{
// 加载数据模型
err := engine.Load(config.Conf)
if err != nil {
fmt.Printf(color.RedString("加载失败: %s\n", err.Error()))
fmt.Println(color.RedString(L("Fatal: %s"), err.Error()))
os.Exit(1)
}
@ -35,12 +35,12 @@ var migrateCmd = &cobra.Command{
// Do Stuff Here
for _, mod := range gou.Models {
fmt.Println(color.GreenString("更新数据模型 %s 绑定数据表: %s", mod.Name, mod.MetaData.Table.Name))
fmt.Println(color.GreenString(L("Update schema model: %s (%s) "), mod.Name, mod.MetaData.Table.Name))
mod.Migrate(true)
}
},
}
func init() {
migrateCmd.PersistentFlags().StringVarP(&name, "name", "n", "", "指定模型名称")
migrateCmd.PersistentFlags().StringVarP(&name, "name", "n", "", L("Model name"))
}

View file

@ -37,6 +37,8 @@ var langs = map[string]string{
"Run: %s": "运行: %s",
"Arguments: %s": "参数错误: %s",
"%s Response": "%s 返回结果",
"Update schema model: %s (%s) ": "更新表结构 model: %s (%s)",
"Model name": "模型名称",
}
// L 多语言切换

View file

@ -33,7 +33,7 @@ var startCmd = &cobra.Command{
mode := config.Conf.Mode
err := engine.Load(config.Conf) // 加载脚本等
if err != nil {
fmt.Printf(color.RedString(L("Fatal: %s"), err.Error()))
fmt.Println(color.RedString(L("Fatal: %s"), err.Error()))
os.Exit(1)
}
port := fmt.Sprintf(":%d", config.Conf.Port)