Allow overriding the schema version number (#19)

This commit is contained in:
Itxaka 2023-05-11 13:30:17 +02:00 committed by GitHub
parent cda46877ba
commit 0b7fd24bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

14
main.go
View File

@ -464,9 +464,21 @@ The validate command expects a configuration file as its only argument. Local fi
},
{
Name: "print-schema",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "version",
Usage: "Print the current schema but with another version number, instead of using the agent version number.",
},
},
Action: func(c *cli.Context) error {
var version string
if c.String("version") != "" {
version = c.String("version")
} else {
version = common.VERSION
}
json, err := agent.JSONSchema(common.VERSION)
json, err := agent.JSONSchema(version)
if err != nil {
return err