databricks-cli/cmd/workspace
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
..
alerts Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
catalogs Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
cluster-policies Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
clusters Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
connections Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
current-user Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
dashboards Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
data-sources Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
experiments Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
external-locations Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
functions Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
git-credentials Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
global-init-scripts Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
grants Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
groups Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
instance-pools Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
instance-profiles Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
ip-access-lists Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
jobs Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
libraries Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
metastores Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
model-registry Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
permissions Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
pipelines Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
policy-families Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
providers Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
queries Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
query-history Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
recipient-activation Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
recipients Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
repos Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
schemas Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
secrets Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
service-principals Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
serving-endpoints Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
shares Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
storage-credentials Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
system-schemas Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
table-constraints Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
tables Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
token-management Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
tokens Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
users Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
volumes Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
warehouses Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
workspace Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
workspace-bindings Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
workspace-conf Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
cmd.go Associate generated commands with command groups (#475) 2023-06-15 14:47:24 +00:00
groups.go Associate generated commands with command groups (#475) 2023-06-15 14:47:24 +00:00