代码拉取完成,页面将自动刷新
// Copyright 2019-present Facebook Inc. All rights reserved.
// This source code is licensed under the Apache 2.0 license found
// in the LICENSE file in the root directory of this source tree.
package main
import (
"bytes"
"log"
"os"
"path/filepath"
"gitee.com/damengde/ent/cmd/internal/base"
"gitee.com/damengde/ent/entc/gen"
"github.com/spf13/cobra"
)
func main() {
log.SetFlags(0)
cmd := &cobra.Command{Use: "entc"}
cmd.AddCommand(
base.NewCmd(),
base.DescribeCmd(),
base.GenerateCmd(migrate),
base.InitCmd(),
)
_ = cmd.Execute()
}
func migrate(c *gen.Config) {
var (
target = filepath.Join(c.Target, "generate.go")
oldCmd = []byte("gitee.com/damengde/ent/cmd/entc")
)
buf, err := os.ReadFile(target)
if err != nil || !bytes.Contains(buf, oldCmd) {
return
}
_ = os.WriteFile(target, bytes.ReplaceAll(buf, oldCmd, []byte("gitee.com/damengde/ent/cmd/ent")), 0644)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。