Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associate generated commands with command groups #475

Merged
merged 3 commits into from
Jun 15, 2023
Merged

Conversation

pietern
Copy link
Contributor

@pietern pietern commented Jun 14, 2023

Changes

With this change related commands show up next to each other in help output.

The ordered list of groups is hard-coded until it can be derived from the specification.

Tests

Manually confirmed that the help output of the root command and the account command list commands by their groups.


// Groups returns an ordered list of command groups.
// The order matches the order used in the Databricks API explorer.
func Groups() []cobra.Group {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you propagate it from x-databricks-groups from spec? otherwise, it'll get out of sync. Please also pull in descriptions from there:

...
  "x-databricks-groups" : [ {
    "x-databricks-package" : "workspace",
    "name" : "Databricks Workspace",
    "description" : "Manage workspace-level entities that include notebooks, Git checkouts, and secrets",
    "tags" : [ "Git Credentials", "Repos", "Secret", "Workspace" ]
  }, {
    "x-databricks-package" : "compute",
    "name" : "Compute",
    "description" : "Use and configure compute for Databricks",
    "tags" : [ "Cluster Policies", "Clusters", "Command Execution", "Global Init Scripts", "Instance Pools", "Instance Profiles", "ManagedLibraries", "Policy Families" ]
  }, {
...

you'll have to add it to codegen and expose from there https://github.com/databricks/databricks-sdk-go/blob/main/openapi/model.go#L41-L46

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in person. This list of packages is incomplete so we need to hardcode it here. Once it is complete and we expose it in the OpenAPI code in the SDK then we can autogenerate these as well.

@pietern pietern requested a review from nfx June 15, 2023 10:34
@pietern pietern enabled auto-merge (squash) June 15, 2023 14:40
@pietern pietern merged commit c080fc6 into main Jun 15, 2023
4 checks passed
@pietern pietern mentioned this pull request Jun 15, 2023
@pietern pietern deleted the command-groups branch June 15, 2023 15:04
pietern added a commit that referenced this pull request Jun 15, 2023
## Changes

CLI:
* Add workspace import-dir command
([#456](#456)).
* Annotate generated commands with OpenAPI package name
([#466](#466)).
* Associate generated commands with command groups
([#475](#475)).
* Disable shell completions for generated commands
([#483](#483)).
* Include [DEFAULT] section header when writing ~/.databrickscfg
([#464](#464)).
* Pass through proxy related environment variables
([#465](#465)).
* Restore flags to original values on test completion
([#470](#470)).
* Update configure command
([#482](#482)).

Dependencies:
* Bump SDK to latest
([#473](#473)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants