Added output template for list-secrets command (#1074)

## Changes

Fixes #1067

## Tests

```
andrew.nester@HFW9Y94129 cli % databricks secrets list-secrets "my-test-scope"  --output text         
Key             Last Updated Timestamp
my-secret       1692805686489
my-test-secret  1692767910771
```
This commit is contained in:
Andrew Nester 2023-12-18 17:09:11 +01:00 committed by GitHub
parent 6dd6899b52
commit 5526cd3fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package secrets
import (
"github.com/databricks/cli/libs/cmdio"
"github.com/databricks/databricks-sdk-go/service/workspace"
"github.com/spf13/cobra"
)
@ -16,7 +17,15 @@ func listScopesOverride(listScopesCmd *cobra.Command) {
{{end}}`)
}
func listSecretsOverride(listSecretsCommand *cobra.Command, _ *workspace.ListSecretsRequest) {
listSecretsCommand.Annotations["template"] = cmdio.Heredoc(`
{{header "Key"}} {{header "Last Updated Timestamp"}}
{{range .}}{{.Key|green}} {{.LastUpdatedTimestamp}}
{{end}}`)
}
func init() {
cmdOverrides = append(cmdOverrides, cmdOverride)
listScopesOverrides = append(listScopesOverrides, listScopesOverride)
listSecretsOverrides = append(listSecretsOverrides, listSecretsOverride)
}