diff --git a/build/generate-man/generate.go b/build/generate-man/generate.go index e16e6930fd..cc14db0c34 100644 --- a/build/generate-man/generate.go +++ b/build/generate-man/generate.go @@ -23,7 +23,7 @@ func main() { log.Fatal(err) } - cmd := cmd.Command(nil, "OPA") + cmd := cmd.RootCommand cmd.Use = "opa [command]" cmd.DisableAutoGenTag = true diff --git a/cmd/commands.go b/cmd/commands.go index 7db65b5f8f..dcd8cdb827 100644 --- a/cmd/commands.go +++ b/cmd/commands.go @@ -10,6 +10,9 @@ import ( iversion "github.com/open-policy-agent/opa/internal/version" ) +// Backwards compatibility definition. Newer code should use Command. +var RootCommand = Command(nil, "OPA") + // UserAgent lets you override the OPA UA sent with all the HTTP requests. // It's another vanity thing -- if you build your own version of OPA, you // may want to adjust this. diff --git a/main.go b/main.go index 8fc400e700..eaa60b3a37 100644 --- a/main.go +++ b/main.go @@ -19,8 +19,7 @@ func main() { } }() // orderly shutdown, run all defer routines - root := cmd.Command(nil, "OPA") - if err := root.Execute(); err != nil { + if err := cmd.RootCommand.Execute(); err != nil { var e *cmd.ExitError if errors.As(err, &e) { exit = e.Exit