From f7b5449a03e2a22ae9664efeec4d4b1c638c2d03 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 15 Jan 2019 18:04:53 +0100 Subject: [PATCH 1/2] Fixed JSON output for 'lib search' and other 'lib' related commands --- arduino/libraries/librariesindex/index.go | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/arduino/libraries/librariesindex/index.go b/arduino/libraries/librariesindex/index.go index 3f986a76330..25447ec0c98 100644 --- a/arduino/libraries/librariesindex/index.go +++ b/arduino/libraries/librariesindex/index.go @@ -22,34 +22,34 @@ import ( "github.com/arduino/arduino-cli/arduino/libraries" "github.com/arduino/arduino-cli/arduino/resources" - "go.bug.st/relaxed-semver" + semver "go.bug.st/relaxed-semver" ) // Index represents the list of libraries available for download type Index struct { - Libraries map[string]*Library + Libraries map[string]*Library `json:"libraries"` } // Library is a library available for download type Library struct { - Name string - Releases map[string]*Release - Latest *Release `json:"-"` - Index *Index `json:"-"` + Name string `json:"name"` + Releases map[string]*Release `json:"releases"` + Latest *Release `json:"-"` + Index *Index `json:"-"` } // Release is a release of a library available for download type Release struct { - Author string - Version *semver.Version - Maintainer string - Sentence string - Paragraph string - Website string - Category string - Architectures []string - Types []string - Resource *resources.DownloadResource + Author string `json:"author"` + Version *semver.Version `json:"version"` + Maintainer string `json:"maintainer"` + Sentence string `json:"sentence"` + Paragraph string `json:"paragraph"` + Website string `json:"website"` + Category string `json:"category"` + Architectures []string `json:"architectures"` + Types []string `json:"types"` + Resource *resources.DownloadResource `json:"resource"` Library *Library `json:"-"` } From 625f20b263dc09a8c5d89d4b2831726941c5664b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 16 Jan 2019 14:04:39 +0100 Subject: [PATCH 2/2] Fixed JSON output for Resource --- arduino/resources/structs.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arduino/resources/structs.go b/arduino/resources/structs.go index 1a2ce02be78..fc5f8f16461 100644 --- a/arduino/resources/structs.go +++ b/arduino/resources/structs.go @@ -19,11 +19,11 @@ package resources // DownloadResource has all the information to download a file type DownloadResource struct { - URL string - ArchiveFileName string - Checksum string - Size int64 - CachePath string + URL string `json:"url"` + ArchiveFileName string `json:"archiveFileName"` + Checksum string `json:"checksum"` + Size int64 `json:"size"` + CachePath string `json:"cachePath"` } // DownloadResult contains the result of a download