mirror of https://github.com/databricks/cli.git
create generated package
This commit is contained in:
parent
446463b9eb
commit
bfe9cc4d50
|
@ -11,10 +11,10 @@
|
|||
"toolchain": {
|
||||
"required": ["go"],
|
||||
"post_generate": [
|
||||
"go run ./bundle/internal/schema/*.go ./bundle/internal/schema/generated/jsonschema.json",
|
||||
"go run ./bundle/internal/schema/*.go ./bundle/generated/jsonschema.json",
|
||||
"echo 'bundle/internal/tf/schema/\\*.go linguist-generated=true' >> ./.gitattributes",
|
||||
"echo 'go.sum linguist-generated=true' >> ./.gitattributes",
|
||||
"echo 'bundle/internal/schema/generated/jsonschema.json linguist-generated=true' >> ./.gitattributes"
|
||||
"echo 'bundle/generated/jsonschema.json linguist-generated=true' >> ./.gitattributes"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,4 +120,4 @@ cmd/workspace/workspace-conf/workspace-conf.go linguist-generated=true
|
|||
cmd/workspace/workspace/workspace.go linguist-generated=true
|
||||
bundle/internal/tf/schema/\*.go linguist-generated=true
|
||||
go.sum linguist-generated=true
|
||||
bundle/internal/schema/generated/jsonschema.json linguist-generated=true
|
||||
bundle/generated/jsonschema.json linguist-generated=true
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package generated
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// go:embed jsonschema.json
|
||||
var BundleSchema []byte
|
|
@ -3,13 +3,11 @@ package bundle
|
|||
import (
|
||||
_ "embed"
|
||||
|
||||
"github.com/databricks/cli/bundle/generated"
|
||||
"github.com/databricks/cli/cmd/root"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
//go:embed _generated/jsonschema.json
|
||||
var bundleSchemaBytes []byte
|
||||
|
||||
func newSchemaCommand() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "schema",
|
||||
|
@ -18,7 +16,7 @@ func newSchemaCommand() *cobra.Command {
|
|||
}
|
||||
|
||||
cmd.RunE = func(cmd *cobra.Command, args []string) error {
|
||||
_, err := cmd.OutOrStdout().Write(bundleSchemaBytes)
|
||||
_, err := cmd.OutOrStdout().Write(generated.BundleSchema)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue