From a4415c030afc6444dfef2ac12958ea38b16fffa1 Mon Sep 17 00:00:00 2001 From: UKEME BASSEY Date: Wed, 17 Apr 2024 09:25:52 -0400 Subject: [PATCH] making json data more useful for client consumption --- internal/command/views/init.go | 18 +++++++++--------- internal/command/views/init_test.go | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/command/views/init.go b/internal/command/views/init.go index 81b5b416f3..15ff7f8012 100644 --- a/internal/command/views/init.go +++ b/internal/command/views/init.go @@ -196,39 +196,39 @@ var MessageRegistry map[InitMessageCode]InitMessage = map[InitMessageCode]InitMe }, "provider_already_installed_message": { HumanValue: "- Using previously-installed %s v%s", - JSONValue: "- Using previously-installed %s v%s", + JSONValue: "%s v%s: Using previously-installed provider version", }, "built_in_provider_available_message": { HumanValue: "- %s is built in to Terraform", - JSONValue: "- %s is built in to Terraform", + JSONValue: "%s is built in to Terraform", }, "reusing_previous_version_info": { HumanValue: "- Reusing previous version of %s from the dependency lock file", - JSONValue: "- Reusing previous version of %s from the dependency lock file", + JSONValue: "%s: Reusing previous version from the dependency lock file", }, "finding_matching_version_message": { HumanValue: "- Finding %s versions matching %q...", - JSONValue: "- Finding %s versions matching %q...", + JSONValue: "Finding matching versions for provider: %s, version_constraint: %q", }, "finding_latest_version_message": { HumanValue: "- Finding latest version of %s...", - JSONValue: "- Finding latest version of %s...", + JSONValue: "%s: Finding latest version...", }, "using_provider_from_cache_dir_info": { HumanValue: "- Using %s v%s from the shared cache directory", - JSONValue: "- Using %s v%s from the shared cache directory", + JSONValue: "%s v%s: Using from the shared cache directory", }, "installing_provider_message": { HumanValue: "- Installing %s v%s...", - JSONValue: "- Installing %s v%s...", + JSONValue: "Installing provider version: %s v%s...", }, "key_id": { HumanValue: ", key ID [reset][bold]%s[reset]", - JSONValue: ", key ID %s", + JSONValue: "key_id: %s", }, "installed_provider_version_info": { HumanValue: "- Installed %s v%s (%s%s)", - JSONValue: "- Installed %s v%s (%s%s)", + JSONValue: "Installed provider version: %s v%s (%s%s)", }, "partner_and_community_providers_message": { HumanValue: partnerAndCommunityProvidersInfo, diff --git a/internal/command/views/init_test.go b/internal/command/views/init_test.go index 2f056cb0c9..5017d71477 100644 --- a/internal/command/views/init_test.go +++ b/internal/command/views/init_test.go @@ -177,7 +177,7 @@ func TestNewInit_jsonViewOutput(t *testing.T) { }, { "@level": "info", - "@message": fmt.Sprintf("- Finding latest version of %s...", packageName), + "@message": fmt.Sprintf("%s: Finding latest version...", packageName), "@module": "terraform.ui", "message_code": "finding_latest_version_message", "type": "init_output", @@ -211,7 +211,7 @@ func TestNewInit_jsonViewOutput(t *testing.T) { }, { "@level": "info", - "@message": fmt.Sprintf("- Using previously-installed %s v%s", packageName, packageVersion), + "@message": fmt.Sprintf("%s v%s: Using previously-installed provider version", packageName, packageVersion), "@module": "terraform.ui", "message_code": "provider_already_installed_message", "type": "init_output",