databricks-cli/cmd
Pieter Noordhuis 3fa400f00f
Remove dependency on global state in generated commands (#595)
## Changes

Generated commands relied on global variables for flags and request
payloads. This is difficult to test if a sequence of tests tries to run
the same command with various arguments because the global state causes
test interference. Moreover, it is impossible to run tests in parallel.

This change modifies the approach and turns every command group and
command itself into a function that returns a `*cobra.Command`. All
flags and request payloads are variables scoped to the command's
initialization function. This means it is possible to construct
independent copies of the CLI structure and fixes the test isolation
issue.

The scope of this change is only the generated commands. The other
commands will be changed accordingly in subsequent changes.

## Tests

Unit and integration tests pass.
2023-07-25 20:19:07 +02:00
..
account Remove dependency on global state in generated commands (#595) 2023-07-25 20:19:07 +02:00
api Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
auth Improve auth login experience (#570) 2023-07-12 15:36:09 +00:00
bundle Add development runs (#522) 2023-07-12 08:51:54 +02:00
configure Update configure command (#482) 2023-06-15 12:50:19 +00:00
fs Update cp help message to not require file scheme (#554) 2023-07-06 13:16:14 +02:00
root Remove dependency on global state in generated commands (#595) 2023-07-25 20:19:07 +02:00
sync First look for databricks.yml before falling back to bundle.yml (#580) 2023-07-18 12:16:34 +02:00
version Use cmdio in version command for `--output` flag (#419) 2023-06-01 12:03:22 +02:00
workspace Remove dependency on global state in generated commands (#595) 2023-07-25 20:19:07 +02:00
cmd.go Remove dependency on global state in generated commands (#595) 2023-07-25 20:19:07 +02:00