Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cmd/ace/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ import (
"github.com/pgedge/ace/pkg/logger"
)

// version is the ACE release version. It defaults to the value below for
// local builds and is overridden at release time via -ldflags "-X main.version=..."
// (see .goreleaser.yaml).
var version = "2.1.0"

func main() {
var cfgPath string
if !shouldSkipConfig(os.Args[1:]) {
Expand Down Expand Up @@ -60,7 +65,7 @@ func main() {
}
}

app := cli.SetupCLI()
app := cli.SetupCLI(version)
err := app.Run(context.Background(), os.Args)
if err != nil {
logger.Error("%v", err)
Expand Down
15 changes: 12 additions & 3 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ var defaultConfigYAML string
//go:embed default_pg_service.conf
var defaultPgServiceConf string

func SetupCLI() *cli.Command {
func SetupCLI(version string) *cli.Command {
// Use -V (not the urfave default -v) for version, so -v stays reserved for
// the debug/verbose flag on subcommands (matching go tooling conventions).
cli.VersionFlag = &cli.BoolFlag{
Name: "version",
Aliases: []string{"V"},
Usage: "print the version",
}

commonFlags := []cli.Flag{
&cli.StringFlag{
Name: "dbname",
Expand Down Expand Up @@ -433,8 +441,9 @@ func SetupCLI() *cli.Command {
}

app := &cli.Command{
Name: "ace",
Usage: "ACE - Active Consistency Engine",
Name: "ace",
Usage: "ACE - Active Consistency Engine",
Version: version,
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Commands: []*cli.Command{
{
Name: "config",
Expand Down
Loading