2023-07-27 10:03:08 +00:00
package bundle
import (
2025-03-09 20:17:56 +00:00
"github.com/databricks/cli/clis"
"github.com/databricks/cli/cmd/auth"
2024-02-14 18:04:45 +00:00
"github.com/databricks/cli/cmd/bundle/deployment"
2025-03-09 20:17:56 +00:00
"github.com/databricks/cli/cmd/root"
2023-07-27 10:03:08 +00:00
"github.com/spf13/cobra"
)
2025-03-09 20:17:56 +00:00
func New ( cliType clis . CLIType ) * cobra . Command {
2023-07-27 10:03:08 +00:00
cmd := & cobra . Command {
2023-12-28 13:14:55 +00:00
Use : "bundle" ,
2025-03-09 20:17:56 +00:00
Short : "Manage Databricks assets as code" ,
Long : "Databricks Asset Bundles let you express data/AI/analytics projects as code.\n\nOnline documentation: https://docs.databricks.com/dev-tools/bundles" ,
2023-12-28 13:14:55 +00:00
GroupID : "development" ,
2023-07-27 10:03:08 +00:00
}
2025-03-09 20:17:56 +00:00
hideForDLT := cliType == clis . DLT
showForDLT := cliType == clis . General || cliType == clis . DAB
hideForGeneralCLI := cliType == clis . General
hideAlways := true
if cliType == clis . DLT {
cmd . Use = "dlt"
cmd . Short = "Use DLT to build efficient & scalable data pipelines."
cmd . Long = cmd . Short + "\n\nOnline documentation: https://docs.databricks.com/delta-live-tables"
}
initVariableFlag ( cmd , hideForDLT )
cmd . AddCommand ( newDeployCommand ( cliType ) )
2023-07-27 10:03:08 +00:00
cmd . AddCommand ( newDestroyCommand ( ) )
cmd . AddCommand ( newLaunchCommand ( ) )
2025-03-09 20:17:56 +00:00
cmd . AddCommand ( newRunCommand ( cliType ) )
cmd . AddCommand ( newDryRunCommand ( showForDLT ) )
cmd . AddCommand ( newSchemaCommand ( hideForDLT ) )
cmd . AddCommand ( newSyncCommand ( hideForDLT ) )
cmd . AddCommand ( newTestCommand ( hideAlways ) )
cmd . AddCommand ( newShowCommand ( hideAlways ) )
validateCmd := newValidateCommand ( hideForDLT , cliType )
cmd . AddCommand ( validateCmd )
cmd . AddCommand ( newInitCommand ( cliType ) )
summaryCmd := newSummaryCommand ( hideForDLT , cliType )
cmd . AddCommand ( summaryCmd )
cmd . AddCommand ( newGenerateCommand ( hideForDLT ) )
2024-04-02 12:56:27 +00:00
cmd . AddCommand ( newDebugCommand ( ) )
2025-03-09 20:17:56 +00:00
cmd . AddCommand ( deployment . NewDeploymentCommand ( hideForDLT , cliType ) )
cmd . AddCommand ( newOpenCommand ( cliType ) )
cmd . AddCommand ( auth . NewTopLevelLoginCommand ( hideForGeneralCLI ) )
if cliType != clis . General {
// HACK: set the output flag locally for the summary and validate commands
root . InitOutputFlag ( summaryCmd )
root . InitOutputFlag ( validateCmd )
}
2023-07-27 10:03:08 +00:00
return cmd
}