From 63d5052211c6011be81a03916bc95280db98397f Mon Sep 17 00:00:00 2001 From: Linh Nguyen Date: Thu, 24 Jun 2021 15:47:12 -0400 Subject: [PATCH] fixed piping through jq functionality --- cmd/account/cli.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/account/cli.go b/cmd/account/cli.go index bf93dc09..8f16b545 100644 --- a/cmd/account/cli.go +++ b/cmd/account/cli.go @@ -76,6 +76,7 @@ func (o *cliOptions) complete(cmd *cobra.Command) error { func (o *cliOptions) run() error { awsClient, err := o.k8sclusterresourcefactory.GetCloudProvider(o.verbose) if err != nil { + return err } @@ -98,7 +99,12 @@ func (o *cliOptions) run() error { } if o.output == "json" { - fmt.Fprintf(o.IOStreams.Out, "%s\n", creds) + fmt.Fprintf(o.IOStreams.Out, "{\n\"AccessKeyId\": %q, \n\"Expiration\": %q, \n\"SecretAccessKey\": %q, \n\"SessionToken\": %q\n}", + *creds.AccessKeyId, + *creds.Expiration, + *creds.SecretAccessKey, + *creds.SessionToken, + ) } if o.output == "env" {