package cli

import (
	"fmt"
	"os"

	"github.com/sirupsen/logrus"
	"github.com/urfave/cli/v2"
)

func RunApp(version, commit string) {
	app := &cli.App{
		Name: "abra",
		Usage: `The Co-op Cloud command-line utility belt 🎩🐇

    ____                           ____ _                 _
   / ___|___         ___  _ __    / ___| | ___  _   _  __| |
  | |   / _ \ _____ / _ \| '_ \  | |   | |/ _ \| | | |/ _' |
  | |__| (_) |_____| (_) | |_) | | |___| | (_) | |_| | (_| |
   \____\___/       \___/| .__/   \____|_|\___/ \__,_|\__,_|
                         |_|
		`,
		Version: fmt.Sprintf("%s-%s", version, commit[:7]),
		Commands: []*cli.Command{
			AppCommand,
			ServerCommand,
			RecipeCommand,
			VersionCommand,
		},
		Flags: []cli.Flag{
			EnvFlag,
			StackFlag,
			SkipCheckFlag,
			SkipUpdateFlag,
			VerboseFlag,
			BranchFlag,
			NoPromptFlag,
			DebugFlag,
			ContextFlag,
		},
	}

	err := app.Run(os.Args)
	if err != nil {
		logrus.Fatal(err)
	}
}