39 lines
742 B
Go
39 lines
742 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/urfave/cli/v3"
|
|
|
|
"gitea.micah.wiki/pandora/magic/cmd"
|
|
"gitea.micah.wiki/pandora/magic/config"
|
|
_ "gitea.micah.wiki/pandora/magic/config"
|
|
"gitea.micah.wiki/pandora/magic/pkg/loggerx"
|
|
)
|
|
|
|
var VERSION = "v1.0.0"
|
|
|
|
func main() {
|
|
// 刷新日志,当程序退出时,把在缓存中的内容刷到日志中
|
|
defer func() {
|
|
loggerx.Sync()
|
|
}()
|
|
|
|
app := cli.NewApp()
|
|
app.Name = "magic"
|
|
app.Version = VERSION
|
|
app.Usage = "A command line tool for tools"
|
|
app.Authors = append(app.Authors, &cli.Author{
|
|
Name: "micah",
|
|
Email: "micah.shi@gmail.com",
|
|
})
|
|
app.Commands = cmd.GetList()
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
fmt.Println(err)
|
|
return
|
|
}
|
|
_ = config.Save(config.Get())
|
|
}
|