Rename: bricks -> databricks (#393)

## Changes
related to https://github.com/databricks/databricks-vscode/pull/721

## Rename env vars

`BRICKS_CLI_PATH` -> `DATABRICKS_CLI_PATH`
`BRICKS_OUTPUT_FORMAT` -> `DATABRICKS_OUTPUT_FORMAT`
`BRICKS_LOG_FILE` -> `DATABRICKS_LOG_FILE`
`BRICKS_LOG_LEVEL` -> `DATABRICKS_LOG_LEVEL`
`BRICKS_LOG_FORMAT` -> `DATABRICKS_LOG_FORMAT`
`BRICKS_PROGRESS_FORMAT` -> `DATABRICKS_CLI_PROGRESS_FORMAT`
`BRICKS_UPSTREAM` -> `DATABRICKS_CLI_UPSTREAM`
`BRICKS_UPSTREAM_VERSION` -> `DATABRICKS_CLI_UPSTREAM_VERSION`
This commit is contained in:
Fabian Jakobs 2023-05-22 16:40:50 +02:00 committed by GitHub
parent cb78644e3c
commit 055e528173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 16 deletions

View File

@ -6,7 +6,7 @@ This project is in private preview.
Documentation about the full REST API coverage is avaialbe in the [docs folder](docs/commands.md). Documentation about the full REST API coverage is avaialbe in the [docs folder](docs/commands.md).
Documentation is available at https://docs.databricks.com/dev-tools/cli/bricks-cli.html. Documentation is available at https://docs.databricks.com/dev-tools/cli/databricks-cli.html.
## Installation ## Installation

View File

@ -97,9 +97,9 @@ func (w *Workspace) Client() (*databricks.WorkspaceClient, error) {
func init() { func init() {
arg0 := os.Args[0] arg0 := os.Args[0]
// Configure BRICKS_CLI_PATH only if our caller intends to use this specific version of this binary. // Configure DATABRICKS_CLI_PATH only if our caller intends to use this specific version of this binary.
// Otherwise, if it is equal to its basename, processes can find it in $PATH. // Otherwise, if it is equal to its basename, processes can find it in $PATH.
if arg0 != filepath.Base(arg0) { if arg0 != filepath.Base(arg0) {
os.Setenv("BRICKS_CLI_PATH", arg0) os.Setenv("DATABRICKS_CLI_PATH", arg0)
} }
} }

View File

@ -12,7 +12,7 @@ type Config struct {
AzureTenantId string `json:"azure_tenant_id,omitempty"` AzureTenantId string `json:"azure_tenant_id,omitempty"`
AzureUseMsi bool `json:"azure_use_msi,omitempty"` AzureUseMsi bool `json:"azure_use_msi,omitempty"`
AzureWorkspaceResourceId string `json:"azure_workspace_resource_id,omitempty"` AzureWorkspaceResourceId string `json:"azure_workspace_resource_id,omitempty"`
BricksCliPath string `json:"bricks_cli_path,omitempty"` DatabricksCliPath string `json:"databricks_cli_path,omitempty"`
ClientId string `json:"client_id,omitempty"` ClientId string `json:"client_id,omitempty"`
ClientSecret string `json:"client_secret,omitempty"` ClientSecret string `json:"client_secret,omitempty"`
ConfigFile string `json:"config_file,omitempty"` ConfigFile string `json:"config_file,omitempty"`

View File

@ -8,14 +8,14 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
const envBricksOutputFormat = "BRICKS_OUTPUT_FORMAT" const envOutputFormat = "DATABRICKS_OUTPUT_FORMAT"
var outputType flags.Output = flags.OutputText var outputType flags.Output = flags.OutputText
func init() { func init() {
// Configure defaults from environment, if applicable. // Configure defaults from environment, if applicable.
// If the provided value is invalid it is ignored. // If the provided value is invalid it is ignored.
if v, ok := os.LookupEnv(envBricksOutputFormat); ok { if v, ok := os.LookupEnv(envOutputFormat); ok {
outputType.Set(v) outputType.Set(v)
} }

View File

@ -11,9 +11,9 @@ import (
) )
const ( const (
envBricksLogFile = "BRICKS_LOG_FILE" envLogFile = "DATABRICKS_LOG_FILE"
envBricksLogLevel = "BRICKS_LOG_LEVEL" envLogLevel = "DATABRICKS_LOG_LEVEL"
envBricksLogFormat = "BRICKS_LOG_FORMAT" envLogFormat = "DATABRICKS_LOG_FORMAT"
) )
func initializeLogger(ctx context.Context) (context.Context, error) { func initializeLogger(ctx context.Context) (context.Context, error) {
@ -52,13 +52,13 @@ var logOutput = flags.OutputText
func init() { func init() {
// Configure defaults from environment, if applicable. // Configure defaults from environment, if applicable.
// If the provided value is invalid it is ignored. // If the provided value is invalid it is ignored.
if v, ok := os.LookupEnv(envBricksLogFile); ok { if v, ok := os.LookupEnv(envLogFile); ok {
logFile.Set(v) logFile.Set(v)
} }
if v, ok := os.LookupEnv(envBricksLogLevel); ok { if v, ok := os.LookupEnv(envLogLevel); ok {
logLevel.Set(v) logLevel.Set(v)
} }
if v, ok := os.LookupEnv(envBricksLogFormat); ok { if v, ok := os.LookupEnv(envLogFormat); ok {
logOutput.Set(v) logOutput.Set(v)
} }

View File

@ -10,7 +10,7 @@ import (
"golang.org/x/term" "golang.org/x/term"
) )
const envBricksProgressFormat = "BRICKS_PROGRESS_FORMAT" const envProgressFormat = "DATABRICKS_CLI_PROGRESS_FORMAT"
func resolveModeDefault(format flags.ProgressLogFormat) flags.ProgressLogFormat { func resolveModeDefault(format flags.ProgressLogFormat) flags.ProgressLogFormat {
if (logLevel.String() == "disabled" || logFile.String() != "stderr") && if (logLevel.String() == "disabled" || logFile.String() != "stderr") &&
@ -40,7 +40,7 @@ var progressFormat = flags.NewProgressLogFormat()
func init() { func init() {
// Configure defaults from environment, if applicable. // Configure defaults from environment, if applicable.
// If the provided value is invalid it is ignored. // If the provided value is invalid it is ignored.
if v, ok := os.LookupEnv(envBricksProgressFormat); ok { if v, ok := os.LookupEnv(envProgressFormat); ok {
progressFormat.Set(v) progressFormat.Set(v)
} }
RootCmd.PersistentFlags().Var(&progressFormat, "progress-format", "format for progress logs (append, inplace, json)") RootCmd.PersistentFlags().Var(&progressFormat, "progress-format", "format for progress logs (append, inplace, json)")

View File

@ -8,8 +8,8 @@ import (
) )
// Environment variables that caller can set to convey what is upstream to this CLI. // Environment variables that caller can set to convey what is upstream to this CLI.
const upstreamEnvVar = "BRICKS_UPSTREAM" const upstreamEnvVar = "DATABRICKS_CLI_UPSTREAM"
const upstreamVersionEnvVar = "BRICKS_UPSTREAM_VERSION" const upstreamVersionEnvVar = "DATABRICKS_CLI_UPSTREAM_VERSION"
// Keys in the user agent. // Keys in the user agent.
const upstreamKey = "upstream" const upstreamKey = "upstream"