From 59de77a3aaf027fc9228d93315097c428245bae8 Mon Sep 17 00:00:00 2001 From: Chris Kim <97423717+mik-ky@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:03:05 +1200 Subject: [PATCH] fix: Removes a whitespace between Path key and value when creating a zip/nupkg with json output format --- pkg/cmd/package/nuget/create/create.go | 15 ++++++++------- pkg/cmd/package/zip/create/create.go | 15 ++++++++------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pkg/cmd/package/nuget/create/create.go b/pkg/cmd/package/nuget/create/create.go index dd466cb3..e7718d03 100644 --- a/pkg/cmd/package/nuget/create/create.go +++ b/pkg/cmd/package/nuget/create/create.go @@ -151,14 +151,15 @@ func createRun(cmd *cobra.Command, opts *NuPkgCreateOptions) error { } nuget, err := pack.BuildPackage(opts.PackageCreateOptions, outFilePath) - if (nuget != nil) { + if nuget != nil { switch outputFormat { - case constants.OutputFormatBasic: - cmd.Printf("%s\n", nuget.Name()) - case constants.OutputFormatJson: - cmd.Printf(`{"Path": "%s"}`, nuget.Name()) - default: // table - cmd.Printf("Successfully created package %s\n", nuget.Name()) + case constants.OutputFormatBasic: + cmd.Printf("%s\n", nuget.Name()) + case constants.OutputFormatJson: + cmd.Printf(`{"Path":"%s"}`, nuget.Name()) + cmd.Println() + default: // table + cmd.Printf("Successfully created package %s\n", nuget.Name()) } } return err diff --git a/pkg/cmd/package/zip/create/create.go b/pkg/cmd/package/zip/create/create.go index 21c7be04..8b50471a 100644 --- a/pkg/cmd/package/zip/create/create.go +++ b/pkg/cmd/package/zip/create/create.go @@ -78,14 +78,15 @@ func createRun(cmd *cobra.Command, opts *pack.PackageCreateOptions) error { outFilePath := pack.BuildOutFileName("zip", opts.Id.Value, opts.Version.Value) zip, err := pack.BuildPackage(opts, outFilePath) - if (zip != nil) { + if zip != nil { switch outputFormat { - case constants.OutputFormatBasic: - cmd.Printf("%s\n", zip.Name()) - case constants.OutputFormatJson: - cmd.Printf(`{"Path": "%s"}`, zip.Name()) - default: // table - cmd.Printf("Successfully created package %s\n", zip.Name()) + case constants.OutputFormatBasic: + cmd.Printf("%s\n", zip.Name()) + case constants.OutputFormatJson: + cmd.Printf(`{"Path":"%s"}`, zip.Name()) + cmd.Println() + default: // table + cmd.Printf("Successfully created package %s\n", zip.Name()) } } return err