Databricks CLI
Go to file
Andrew Nester 9cf0e0db24
Correctly set ExactArgs if generated command has positional arguments (#488)
## Changes
Some of the command such as `databricks alerts create` require
positional arguments which are not primitive.

Since these arguments are required, we should correctly set ExactArgs
for such commands

Fixes #367 

## Tests
Running `databricks alerts create`

Before
```
andrew.nester@HFW9Y94129 cli % ./cli alerts create                     
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/databricks/bricks/cmd/workspace/alerts.glob..func1(0x22a1280?, {0x2321638, 0x0, 0x0?})
	github.com/databricks/bricks/cmd/workspace/alerts/alerts.go:57 +0x355
github.com/spf13/cobra.(*Command).execute(0x22a1280, {0x2321638, 0x0, 0x0})
	github.com/spf13/cobra@v1.7.0/command.go:940 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x22a0700)
	github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3bd
github.com/spf13/cobra.(*Command).ExecuteContextC(...)
	github.com/spf13/cobra@v1.7.0/command.go:1001
github.com/databricks/bricks/cmd/root.Execute()
	github.com/databricks/bricks/cmd/root/root.go:80 +0x6a
main.main()
	github.com/databricks/bricks/main.go:18 +0x17                                           

```

After
```
andrew.nester@HFW9Y94129 cli % ./cli alerts create                                                                
Error: provide command input in JSON format by specifying --json option
```
Acceptance test
```
=== RUN   TestAccAlertsCreateErrWhenNoArguments
    alerts_test.go:10: gcp
    helpers.go:147: Error running command: provide command input in JSON format by specifying --json option
--- PASS: TestAccAlertsCreateErrWhenNoArguments (1.99s)
PASS
```
2023-06-16 12:15:25 +00:00
.codegen Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
.github Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
.vscode Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
bundle Pass through proxy related environment variables (#465) 2023-06-14 21:58:26 +02:00
cmd Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
docs Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
folders Don't depend on working directory in folders.FindDirWithLeaf (#54) 2022-09-14 15:08:55 +02:00
internal Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
libs Update configure command (#482) 2023-06-15 12:50:19 +00:00
python Update setup.py (#397) 2023-05-23 11:39:57 +02:00
.codegen.json Added OpenAPI command coverage (#357) 2023-04-26 13:06:16 +02:00
.gitattributes Update with the latest Go SDK (#457) 2023-06-12 14:23:21 +02:00
.gitignore Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
.goreleaser.yaml Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
CHANGELOG.md Release v0.100.4 (#486) 2023-06-15 15:04:11 +00:00
LICENSE Create LICENSE (#467) 2023-06-14 14:38:52 +00:00
Makefile goreleaser deprecated --rm-dist in favor of --clean (#349) 2023-04-20 11:59:34 +02:00
NOTICE Create NOTICE (#468) 2023-06-14 20:05:08 +02:00
README.md Add installation instructions (#458) 2023-06-12 16:31:22 +02:00
go.mod Bump SDK to latest (#473) 2023-06-14 18:27:29 +00:00
go.sum Bump SDK to latest (#473) 2023-06-14 18:27:29 +00:00
main.go Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00
main_test.go Rename bricks -> databricks (#389) 2023-05-16 18:35:39 +02:00

README.md

Databricks CLI

build

This project is in private preview.

Documentation about the full REST API coverage is avaialbe in the docs folder.

Documentation is available at https://docs.databricks.com/dev-tools/cli/databricks-cli.html.

Installation

This CLI is packaged as a dependency-free binary executable and may be located in any directory. See https://github.com/databricks/cli/releases for releases and the docs pages for installation instructions.

Authentication

This CLI follows the Databricks Unified Authentication principles.

You can find a detailed description at https://github.com/databricks/databricks-sdk-go#authentication.