package main

import (
	"log"
	"os"

	"bitbucket.org/robert2206/automation/cmd"
	"bitbucket.org/robert2206/automation/modules/models"
	"bitbucket.org/robert2206/automation/modules/settings"
	"github.com/urfave/cli"
)

func init() {
	settings.Init()
	models.Init()
}

func main() {
	app := cli.NewApp()
	app.Name = "Eiru Automation"
	app.Usage = "A ligthweight eiru automation for docker and odoo"
	app.Commands = []cli.Command{
		cmd.APICmd,
	}
	app.Flags = append(app.Flags, []cli.Flag{}...)
	app.Action = cmd.APICmd.Action

	err := app.Run(os.Args)

	if err != nil {
		log.Fatal(4, "Failed to run app with %s: %v", os.Args, err)
	}
}
