From e008fb26a27ba38b7adeb84e930f62b37c606da1 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:02:16 +0200 Subject: [PATCH] Cleanup --- cli/packages/cmd/run.go | 1 - cli/packages/cmd/secrets.go | 2 +- cli/packages/util/helper.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cli/packages/cmd/run.go b/cli/packages/cmd/run.go index f137a146d..04fe2588b 100644 --- a/cli/packages/cmd/run.go +++ b/cli/packages/cmd/run.go @@ -312,6 +312,5 @@ func execCmd(cmd *exec.Cmd) error { waitStatus := cmd.ProcessState.Sys().(syscall.WaitStatus) os.Exit(waitStatus.ExitStatus()) - return nil } diff --git a/cli/packages/cmd/secrets.go b/cli/packages/cmd/secrets.go index 80b1d0292..f2f694075 100644 --- a/cli/packages/cmd/secrets.go +++ b/cli/packages/cmd/secrets.go @@ -116,7 +116,7 @@ var secretsCmd = &cobra.Command{ secrets = util.ExpandSecrets(secrets, authParams, "") } - // convert secrets to the same order as the keys + // Sort the secrets by key so we can create a consistent output secrets = util.SortSecretsByKeys(secrets) visualize.PrintAllSecretDetails(secrets) diff --git a/cli/packages/util/helper.go b/cli/packages/util/helper.go index 33e22e040..5ffe5c9f1 100644 --- a/cli/packages/util/helper.go +++ b/cli/packages/util/helper.go @@ -53,8 +53,8 @@ func GetBase64DecodedSymmetricEncryptionDetails(key string, cipher string, IV st }, nil } +// Helper function to sort the secrets by key so we can create a consistent output func SortSecretsByKeys(secrets []models.SingleEnvironmentVariable) []models.SingleEnvironmentVariable { - // sort secrets by key for i := 0; i < len(secrets); i++ { for j := i + 1; j < len(secrets); j++ { if secrets[i].Key > secrets[j].Key {