// An application for generating certificates via ACME.
package main

import (
	"context"
	"fmt"
	"os"
	"runtime"

	"github.com/go-acme/lego/v5/cmd"
	"github.com/go-acme/lego/v5/log"
	"github.com/urfave/cli/v3"
)

func main() {
	app := cmd.CreateRootCommand()
	app.Version = getVersion()

	cli.VersionPrinter = func(cmd *cli.Command) {
		fmt.Printf("lego version %s %s/%s\n", cmd.Version, runtime.GOOS, runtime.GOARCH)
	}

	err := app.Run(context.Background(), os.Args)
	if err != nil {
		log.Fatal("Error", log.ErrorAttr(err))
	}
}
