budget-go/cmd/cli/cli.go
2024-09-17 15:00:21 +02:00

38 lines
866 B
Go

package main
import (
"flag"
"log"
"os"
"github.com/urfave/cli/v2"
userAdd "gitnet.fr/deblan/budget/cli/user/add"
userChangePassword "gitnet.fr/deblan/budget/cli/user/changepassword"
userDelete "gitnet.fr/deblan/budget/cli/user/delete"
"gitnet.fr/deblan/budget/config"
"gitnet.fr/deblan/budget/database/manager"
"gitnet.fr/deblan/budget/database/model"
)
func main() {
ini := flag.String("c", "config.ini", "Path to config.ini")
config.Get().Load(*ini)
manager.Get().Db.AutoMigrate(&model.User{})
app := &cli.App{
Commands: []*cli.Command{
{
Name: "user",
Subcommands: []*cli.Command{
{Name: "add", Action: userAdd.Command},
{Name: "delete", Action: userDelete.Command},
{Name: "change-password", Action: userChangePassword.Command},
},
},
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}