代码拉取完成,页面将自动刷新
package main
import (
"gf-mysql-transfer/internal/config/log"
"gf-mysql-transfer/internal/consts"
_ "gf-mysql-transfer/internal/packed"
"gf-mysql-transfer/internal/utility/allyes"
_ "gf-mysql-transfer/internal/utility/allyes"
_ "github.com/gogf/gf/contrib/drivers/clickhouse/v2"
_ "github.com/gogf/gf/contrib/drivers/dm/v2"
_ "github.com/gogf/gf/contrib/drivers/mssql/v2"
_ "github.com/gogf/gf/contrib/drivers/mysql/v2"
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gcfg"
"github.com/gogf/gf/v2/os/gcmd"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/os/glog"
"github.com/gogf/gf/v2/text/gstr"
"github.com/gogf/gf/v2/os/gctx"
"gf-mysql-transfer/internal/cmd"
)
func main() {
defer func() {
if exception := recover(); exception != nil {
if err, ok := exception.(error); ok {
glog.Print(gctx.New(), err.Error())
} else {
panic(exception)
}
}
}()
var (
ctx = gctx.New()
)
// CLI configuration.
if path, _ := gfile.Search(consts.CliFolderName); path != "" {
if adapter, ok := g.Cfg().GetAdapter().(*gcfg.AdapterFile); ok {
if err := adapter.SetPath(path); err != nil {
glog.Fatal(ctx, err)
}
}
}
// zsh alias "git fetch" conflicts checks.
handleZshAlias()
// -y option checks.
allyes.Init()
log.InitLog()
command, err := gcmd.NewFromObject(cmd.Transfer)
if err != nil {
panic(err)
}
err = command.AddObject(
cmd.Serve,
cmd.Version,
)
if err != nil {
panic(err)
}
command.Run(ctx)
}
// zsh alias "git fetch" conflicts checks.
func handleZshAlias() {
if home, err := gfile.Home(); err == nil {
zshPath := gfile.Join(home, ".zshrc")
if gfile.Exists(zshPath) {
var (
aliasCommand = `alias transfer=transfer`
content = gfile.GetContents(zshPath)
)
if !gstr.Contains(content, aliasCommand) {
_ = gfile.PutContentsAppend(zshPath, "\n"+aliasCommand+"\n")
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。