diff --git a/acceptance/cmd/unknown-subcommand/output.txt b/acceptance/cmd/unknown-subcommand/output.txt index 14bd12a4755..77ef660d74e 100644 --- a/acceptance/cmd/unknown-subcommand/output.txt +++ b/acceptance/cmd/unknown-subcommand/output.txt @@ -9,7 +9,7 @@ Usage: databricks secrets [flags] databricks secrets [command] -Available Commands +Available Commands: create-scope Create a new secret scope. delete-acl Delete an ACL. delete-scope Delete a secret scope. diff --git a/acceptance/cmd/workspace/secrets/output.txt b/acceptance/cmd/workspace/secrets/output.txt index bfafcb3416b..d0cf9312c6b 100644 --- a/acceptance/cmd/workspace/secrets/output.txt +++ b/acceptance/cmd/workspace/secrets/output.txt @@ -15,7 +15,7 @@ Usage: databricks secrets [flags] databricks secrets [command] -Available Commands +Available Commands: create-scope Create a new secret scope. delete-acl Delete an ACL. delete-scope Delete a secret scope. diff --git a/acceptance/pipelines/databricks-cli-help/output.txt b/acceptance/pipelines/databricks-cli-help/output.txt index f558ed25192..bd8a3a6fa5e 100644 --- a/acceptance/pipelines/databricks-cli-help/output.txt +++ b/acceptance/pipelines/databricks-cli-help/output.txt @@ -18,7 +18,7 @@ Usage: databricks pipelines [flags] databricks pipelines [command] -Available Commands +Main Commands deploy Deploy pipelines destroy Destroy a pipelines project dry-run Validate correctness of the pipeline's graph diff --git a/cmd/cmd.go b/cmd/cmd.go index 1587fbdc7ea..2c1a32caa50 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -34,9 +34,18 @@ const ( ) // configureGroups adds groups to the command, only if a group -// has at least one available command. +// has at least one available command. When only one group survives +// filtering, the grouping is dropped so Cobra's default "Available +// Commands" heading is used — matching commands that don't define +// groups at all. func configureGroups(cmd *cobra.Command, groups []cobra.Group) { filteredGroups := cmdgroup.FilterGroups(groups, cmd.Commands()) + if len(filteredGroups) <= 1 { + for _, sub := range cmd.Commands() { + sub.GroupID = "" + } + return + } for i := range filteredGroups { cmd.AddGroup(&filteredGroups[i]) } @@ -85,7 +94,7 @@ func New(ctx context.Context) *cobra.Command { groups := []cobra.Group{ { ID: mainGroup, - Title: "Available Commands", + Title: "Main Commands", }, { ID: pipelines.ManagementGroupID,