databricks-cli/libs/cmdio
Pieter Noordhuis b9406efd27
Update configure command (#482)
## Changes

This now uses:
* libs/cmdio to determine interactivity and perform prompting
* libs/databrickscfg to persist the profile

It loads a config.Config structure from the environment just like we do
for unified authentication. It is therefore possible to specify both the
host and token with environment variables.

## Tests

```
pieter.noordhuis@L4GHXDT29P /tmp % export DATABRICKS_CONFIG_FILE=.databrickscfg
pieter.noordhuis@L4GHXDT29P /tmp % databricks configure
Databricks Host: https://foo.bar
Personal Access Token: *****
pieter.noordhuis@L4GHXDT29P /tmp % cat .databrickscfg
[DEFAULT]
host  = https://foo.bar
token = token
pieter.noordhuis@L4GHXDT29P /tmp % echo token | databricks configure
Error: host must be set in non-interactive mode
pieter.noordhuis@L4GHXDT29P /tmp % echo token | databricks configure --host foo
Error: must start with https://
pieter.noordhuis@L4GHXDT29P /tmp % echo token | databricks configure --host https://foo
pieter.noordhuis@L4GHXDT29P /tmp % cat .databrickscfg
[DEFAULT]
host  = https://foo
token = token
pieter.noordhuis@L4GHXDT29P /tmp % cat .databrickscfg
pieter.noordhuis@L4GHXDT29P /tmp % databricks configure --host https://foo
Personal Access Token: ******
pieter.noordhuis@L4GHXDT29P /tmp % cat .databrickscfg
[DEFAULT]
host  = https://foo
token = token2
```
2023-06-15 12:50:19 +00:00
..
context.go Add bundle destroy command (#300) 2023-04-06 12:54:58 +02:00
error_event.go Use cmdio logger to log bricks cmd execution errors (#348) 2023-04-24 12:11:52 +02:00
event.go Move state to event for whether they support inplace progress logging (#339) 2023-04-18 14:20:35 +02:00
io.go Update configure command (#482) 2023-06-15 12:50:19 +00:00
logger.go Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
logger_test.go Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
message_event.go Log mutator messages using progress logger (#312) 2023-04-18 16:55:06 +02:00
render.go Add new line to cmdio JSON rendering (#443) 2023-06-08 15:48:51 +02:00