Skip to content
go-libfossil Artifact [71f3a0cf52]
Login

Artifact [71f3a0cf52]

Artifact 71f3a0cf520ffdad6cf8f90004fdf264e3fd84abbdda86499f32d11bcf66e34c:


package main

import (
	"github.com/alecthomas/kong"
	"github.com/danmestas/go-libfossil/cli"
	_ "github.com/danmestas/go-libfossil/db/driver/modernc"
)

// CLI is the top-level command structure.
//
// Version is deliberately a subcommand only, not also a global --version
// flag: `repo extract` already has its own --version flag (the source
// version to extract from), and kong's global flags are visible in every
// subcommand's context, so a root-level --version would collide with it.
// Renaming that existing, unrelated flag to make room isn't part of this
// change.
type CLI struct {
	cli.Globals

	Repo    cli.RepoCmd    `cmd:"" help:"Repository operations"`
	Version cli.VersionCmd `cmd:"" help:"Print version information"`
}

func main() {
	var c CLI
	ctx := kong.Parse(&c,
		kong.Name("libfossil"),
		kong.Description("Fossil-compatible repository tool (pure Go)"),
		kong.UsageOnError(),
	)
	err := ctx.Run(&c.Globals)
	ctx.FatalIfErrorf(err)
}