Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .codegen/service.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func New() *cobra.Command {
// This service is being previewed; hide from help output.
Hidden: true,
{{- end }}
RunE: root.ReportUnknownSubcommand,
}

{{ if gt (len .Methods) 0 -}}
Expand Down
1 change: 1 addition & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Upgraded TF provider to 1.73.0 ([#2728](https://github.com/databricks/cli/pull/2728))

### CLI
* Added an error when invalid subcommand is provided for CLI commands ([#2655](https://github.com/databricks/cli/pull/2655))
* Added dry-run flag support to sync command ([#2657](https://github.com/databricks/cli/pull/2657))

### Bundles
Expand Down
39 changes: 39 additions & 0 deletions acceptance/cmd/unknown-subcommand/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

>>> errcode [CLI] secrets list-scopes
Scope Backend Type

>>> errcode [CLI] secrets unknown
Error: unknown command "unknown" for "databricks secrets"

Usage:
databricks secrets [flags]
databricks secrets [command]

Available Commands
create-scope Create a new secret scope.
delete-acl Delete an ACL.
delete-scope Delete a secret scope.
delete-secret Delete a secret.
get-acl Get secret ACL details.
get-secret Get a secret.
list-acls Lists ACLs.
list-scopes List all scopes.
list-secrets List secret keys.
put-acl Create/update an ACL.
put-secret Add a secret.

Permission Commands

Flags:
-h, --help help for secrets

Global Flags:
--debug enable debug logging
-o, --output type output type: text or json (default text)
-p, --profile string ~/.databrickscfg profile
-t, --target string bundle target to use (if applicable)

Use "databricks secrets [command] --help" for more information about a command.


Exit code: 1
2 changes: 2 additions & 0 deletions acceptance/cmd/unknown-subcommand/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trace errcode $CLI secrets list-scopes
trace errcode $CLI secrets unknown
8 changes: 8 additions & 0 deletions acceptance/cmd/unknown-subcommand/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Local = true
Cloud = false

[[Server]]
Pattern = "GET /api/2.0/secrets/scopes/list"
Response.Body = """
{}
"""
1 change: 1 addition & 0 deletions acceptance/help/output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Vector Search
Dashboards
genie Genie provides a no-code experience for business users, powered by AI/BI.
lakeview These APIs provide specific management operations for Lakeview dashboards.
lakeview-embedded Token-based Lakeview APIs for embedding dashboards in external applications.
Comment thread
andrewnester marked this conversation as resolved.

Marketplace
consumer-fulfillments Fulfillments are entities that allow consumers to preview installations.
Expand Down
1 change: 1 addition & 0 deletions cmd/account/access-control/access-control.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/billable-usage/billable-usage.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/budget-policy/budget-policy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/budgets/budgets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/credentials/credentials.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/encryption-keys/encryption-keys.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/federation-policy/federation-policy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/groups/groups.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/ip-access-lists/ip-access-lists.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/log-delivery/log-delivery.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/metastore-assignments/metastore-assignments.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/metastores/metastores.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/network-connectivity/network-connectivity.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/networks/networks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/o-auth-published-apps/o-auth-published-apps.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/personal-compute/personal-compute.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/private-access/private-access.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/service-principals/service-principals.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cmd/account/settings/settings.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/storage-credentials/storage-credentials.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/storage/storage.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/usage-dashboards/usage-dashboards.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/users/users.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/vpc-endpoints/vpc-endpoints.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/workspace-assignment/workspace-assignment.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cmd/account/workspaces/workspaces.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions cmd/root/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,19 @@ Stack Trace:

return err
}

// This function is used to report an unknown subcommand.
// It is used in the [cobra.Command.RunE] field of commands that have subcommands.
// If user provided a valid subcommand, RunE for the
// If there are any arguments, it means the user has provided an unknown subcommand.
// If there are no arguments, it means the user has not provided any subcommand, and the help
// command should be displayed.
func ReportUnknownSubcommand(cmd *cobra.Command, args []string) error {
if len(args) > 0 {
return &InvalidArgsError{
Message: fmt.Sprintf("unknown command %q for %q", args[0], cmd.CommandPath()),
Command: cmd,
}
}
return cmd.Help()
}
1 change: 1 addition & 0 deletions cmd/workspace/access-control/access-control.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading