1 Star 1 Fork 0

雨过天晴 / molego

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
molego.go 1.09 KB
一键复制 编辑 原始数据 按行查看 历史
luwei 提交于 2022-10-30 17:39 . 首次提交
// Copyright 2022 The Molego Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"flag"
"fmt"
"os"
"strings"
config "gitee.com/west0207/molego/core/config"
handle "gitee.com/west0207/molego/core/handle"
. "gitee.com/west0207/molego/core/log"
)
// 入口函数
func main() {
flag.BoolVar(&config.XormLog, "x", false, "显示中间件xorm的Debug信息")
flag.BoolVar(&config.DryRun, "d", false, "空转,仅输出sql文本")
flag.BoolVar(&config.Version, "v", false, "版本号")
// var username string
// flag.StringVar(&username, "u", "", "用户名,默认为空")
flag.Parse()
if config.Version {
fmt.Printf("molego v%v\n", config.MolegoVersion)
os.Exit(0)
}
Run()
}
// 运行入口,外部应用可以调用该方法运行
func Run() {
InitLog()
Sug.Infof("molego start")
if err := handle.Handle(config.YamlConfig); err != nil {
if strings.HasPrefix(err.Error(), "molego stopped") {
Sug.Info(err.Error())
} else {
Sug.Errorf("%v", err)
}
}
Sug.Infof("molego end")
}
Go
1
https://gitee.com/west0207/molego.git
git@gitee.com:west0207/molego.git
west0207
molego
molego
master

搜索帮助