exclude/main.go
onyx-and-iris 8059255d52 add del command
add tests for all commands

wrap entry point with fang

add --version flag
target to Taskfile
2026-03-29 21:15:56 +01:00

32 lines
563 B
Go

package main
import (
"context"
"os"
"runtime/debug"
"strings"
"github.com/charmbracelet/fang"
"github.com/onyx-and-iris/exclude/cmd"
)
var version string // Version of the CLI, set during build time
func main() {
if err := fang.Execute(context.Background(), cmd.RootCmd, fang.WithVersion(versionFromBuild())); err != nil {
os.Exit(1)
}
}
func versionFromBuild() string {
if version != "" {
return version
}
info, ok := debug.ReadBuildInfo()
if !ok {
return "(unable to read version)"
}
return strings.Split(info.Main.Version, "-")[0]
}