mirror of https://github.com/databricks/cli.git
44 lines
1.0 KiB
Go
44 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"strings"
|
|
|
|
"github.com/databricks/cli/clis"
|
|
"github.com/databricks/cli/cmd"
|
|
"github.com/databricks/cli/cmd/bundle"
|
|
"github.com/databricks/cli/cmd/root"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func main() {
|
|
ctx := context.Background()
|
|
bundleCmd := bundle.New(clis.DLT)
|
|
|
|
// HACK: copy functionality from root command
|
|
rootCmd := cmd.New(ctx)
|
|
root.InitTargetFlag(bundleCmd)
|
|
bundleCmd.PersistentPreRunE = rootCmd.PersistentPreRunE
|
|
|
|
// HACK: Replace "databricks bundle" with "dlt" in all command descriptions
|
|
replaceCommandDescriptions(bundleCmd)
|
|
|
|
err := root.Execute(ctx, bundleCmd)
|
|
if err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
// replaceCommandDescriptions recursively replaces "databricks bundle" with "dlt" in all command Long descriptions
|
|
func replaceCommandDescriptions(cmd *cobra.Command) {
|
|
if cmd.Long != "" {
|
|
cmd.Long = strings.ReplaceAll(cmd.Long, "databricks bundle", "dlt")
|
|
}
|
|
|
|
// Recursively process all subcommands
|
|
for _, subCmd := range cmd.Commands() {
|
|
replaceCommandDescriptions(subCmd)
|
|
}
|
|
}
|