// Package version provides build version information
package version

// Build-time variables set via ldflags
//
//nolint:gochecknoglobals // These must be variables to allow ldflags injection at build time
var (
	// GitRevision is the git commit hash
	GitRevision = "unknown"
	// GitRevisionShort is the short git commit hash (7 chars)
	GitRevisionShort = "unknown"
)

const (
	// Name is the program name
	Name = "routewatch"
	// Author is the program author
	Author = "@sneak"
	// AuthorURL is the author's website
	AuthorURL = "https://sneak.berlin"
	// License is the program license
	License = "WTFPL"
	// RepoURL is the git repository URL
	RepoURL = "https://git.eeqj.de/sneak/routewatch"
)

// CommitURL returns the URL to view the current commit
func CommitURL() string {
	if GitRevision == "unknown" {
		return RepoURL
	}

	return RepoURL + "/commit/" + GitRevision
}
