Configure cobra.NoArgs for bundle commands where applicable (#1250)

## Changes

Return an error if unused arguments are passed to these commands.

## Tests

n/a
This commit is contained in:
Pieter Noordhuis 2024-03-01 16:50:20 +01:00 committed by GitHub
parent d12f88e24d
commit e1407038d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 12 deletions

View File

@ -13,6 +13,7 @@ func newDeployCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "deploy",
Short: "Deploy bundle",
Args: cobra.NoArgs,
PreRunE: utils.ConfigureBundleWithVariables,
}

View File

@ -16,9 +16,9 @@ import (
func newDestroyCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "destroy",
Short: "Destroy deployed bundle resources",
Use: "destroy",
Short: "Destroy deployed bundle resources",
Args: cobra.NoArgs,
PreRunE: utils.ConfigureBundleWithVariables,
}

View File

@ -17,9 +17,8 @@ import (
func newRunCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "run [flags] KEY",
Short: "Run a resource (e.g. a job or a pipeline)",
Use: "run [flags] KEY",
Short: "Run a resource (e.g. a job or a pipeline)",
Args: cobra.MaximumNArgs(1),
PreRunE: utils.ConfigureBundleWithVariables,
}

View File

@ -13,6 +13,7 @@ func newSchemaCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "schema",
Short: "Generate JSON Schema for bundle configuration",
Args: cobra.NoArgs,
}
cmd.RunE = func(cmd *cobra.Command, args []string) error {

View File

@ -18,9 +18,9 @@ import (
func newSummaryCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "summary",
Short: "Describe the bundle resources and their deployment states",
Use: "summary",
Short: "Describe the bundle resources and their deployment states",
Args: cobra.NoArgs,
PreRunE: utils.ConfigureBundleWithVariables,
// This command is currently intended for the Databricks VSCode extension only

View File

@ -12,9 +12,9 @@ import (
func newValidateCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "validate",
Short: "Validate configuration",
Use: "validate",
Short: "Validate configuration",
Args: cobra.NoArgs,
PreRunE: utils.ConfigureBundleWithVariables,
}