databricks-cli/cmd
Pieter Noordhuis 4fea0219fd
Use `fs.FS` interface to read template (#1910)
## Changes

While working on the v2 of #1744, I found that:
* Template initialization first copies built-in templates to a temporary
directory before initializing them
* Reading a template's contents goes through a `filer.Filer` but is
hardcoded to a local one

This change updates the interface for reading templates to be `fs.FS`.
This is compatible with the `embed.FS` type for the built-in templates,
so they no longer have to be copied to a temporary directory before
being used.

The alternative is to use a `filer.Filer` throughout, but this would
have required even more plumbing, and we don't need to _read_ templates,
including notebooks, from the workspace filesystem (yet?).

As part of making `template.Materialize` take an `fs.FS` argument, the
logic to match a given argument to a particular built-in template in the
`init` command has moved to sit next to its implementation.

## Tests

Existing tests pass.
2024-11-20 09:28:35 +00:00
..
account Bump github.com/databricks/databricks-sdk-go from 0.49.0 to 0.51.0 (#1878) 2024-11-13 13:40:53 +00:00
api Added JSON input validation for CLI commands (#1771) 2024-10-11 14:39:53 +00:00
auth Do not error if we cannot prompt for a profile in `auth login` (#1745) 2024-09-04 07:14:21 +00:00
bundle Use `fs.FS` interface to read template (#1910) 2024-11-20 09:28:35 +00:00
configure Fix `databricks configure` to use DATABRICKS_CONFIG_FILE environment variable if exists as config file (#1325) 2024-06-24 10:56:49 +00:00
fs Consolidate test helpers for `io/fs` (#1906) 2024-11-15 15:37:21 +00:00
labs Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00
root Extract functionality to detect if the CLI is running on DBR (#1889) 2024-11-14 16:10:45 +00:00
sync Rename `RootPath` -> `BundleRootPath` (#1792) 2024-09-27 10:03:05 +00:00
version Add usage string when command fails with incorrect arguments (#1276) 2024-03-12 14:12:34 +00:00
workspace Bump github.com/databricks/databricks-sdk-go from 0.49.0 to 0.51.0 (#1878) 2024-11-13 13:40:53 +00:00
cmd.go Upgrade Go SDK to 0.44.0 (#1679) 2024-08-15 13:23:07 +00:00