databricks-cli/cmd/account
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
..
access-control Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
billable-usage Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
budgets Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
credentials Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
custom-app-integration Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
encryption-keys Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
groups 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
log-delivery Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
metastore-assignments Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
metastores Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
networks Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
o-auth-enrollment Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
private-access Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
published-app-integration Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
service-principal-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
settings Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
storage Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
storage-credentials 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
vpc-endpoints Disable shell completions for generated commands (#483) 2023-06-15 14:56:36 +00:00
workspace-assignment Correctly set ExactArgs if generated command has positional arguments (#488) 2023-06-16 12:15:25 +00:00
workspaces 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