Files
pack/cli/schema.go
T
2025-01-27 23:16:26 -05:00

31 lines
632 B
Go

package cli
import (
"context"
"encoding/json"
"os"
"github.com/railwayapp/railpack/core/config"
"github.com/urfave/cli/v3"
)
var SchemaCommand = &cli.Command{
Name: "schema",
Usage: "outputs the JSON schema for the Railpack config",
EnableShellCompletion: true,
Flags: []cli.Flag{},
Action: func(ctx context.Context, cmd *cli.Command) error {
schema := config.GetJsonSchema()
schemaJson, err := json.MarshalIndent(schema, "", " ")
if err != nil {
return cli.Exit(err, 1)
}
os.Stdout.Write(schemaJson)
os.Stdout.Write([]byte("\n"))
return nil
},
}