Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --omit-releases-details flag in lib search #2102

Merged
merged 2 commits into from
Mar 13, 2023

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Mar 9, 2023

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

The command lib search now has a --omit-releases-details.
When this flag is enabled the search result will be much more compact in JSON and gRPC.

What is the current behavior?

$ arduino-cli lib search FlashStorage Cristian --format json
{
  "libraries": [
    {
      "name": "FlashStorage_SAMD",
      "releases": {
        "1.0.0": {
          "author": "Various",
          "version": "1.0.0",
          "maintainer": "Khoi Hoang \[email protected]\u003e",
          "sentence": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of microcontrollers.",
          "paragraph": "Useful if the EEPROM is not available or too small. Currently, ATSAMD21 and ATSAMD51 are supported (and consequently every board based on this cpu like the Arduino Zero, Aduino MKR1000, Nano-33 IoT, Itsy-Bitsy M4, etc).",
          "website": "https://github.com/khoih-prog/FlashStorage_SAMD",
          "category": "Data Storage",
          "architectures": [
            "samd"
          ],
          "types": [
            "Contributed"
          ],
          "resources": {
            "url": "https://downloads.arduino.cc/libraries/github.com/khoih-prog/FlashStorage_SAMD-1.0.0.zip",
            "archive_filename": "FlashStorage_SAMD-1.0.0.zip",
            "checksum": "SHA-256:25a8cd19a5c7eab08bdc7e885ec89023046cca2f878d6c6d2f2a6322613cb3ef",
            "size": 18275,
            "cache_path": "libraries"
          },
          "license": "MIT"
        },
        "1.1.0": {
          "author": "Cristian Maglie \[email protected]\u003e, Khoi Hoang \[email protected]\u003e",
          "version": "1.1.0",
          "maintainer": "Khoi Hoang \[email protected]\u003e",
          "sentence": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of SAMD21/SAMD51. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.",
          "paragraph": "Useful if the EEPROM is not available or too small. Currently, ATSAMD21 and ATSAMD51 are supported (and consequently every board based on this cpu like the Arduino Zero, Aduino MKR1000, Nano-33 IoT, Itsy-Bitsy M4, etc).",
          "website": "https://github.com/khoih-prog/FlashStorage_SAMD",
          "category": "Data Storage",
          "architectures": [
            "samd"
          ],
          "types": [
            "Contributed"
          ],
          "resources": {
            "url": "https://downloads.arduino.cc/libraries/github.com/khoih-prog/FlashStorage_SAMD-1.1.0.zip",
            "archive_filename": "FlashStorage_SAMD-1.1.0.zip",
            "checksum": "SHA-256:fedb26f02762698592d42ac21bc2f9234f868b72c2f8d8e1fddec18a36511bc5",
            "size": 140259,
            "cache_path": "libraries"
          },
          "license": "MIT"
        },
        "1.2.0": {
          "author": "Cristian Maglie \[email protected]\u003e, Khoi Hoang \[email protected]\u003e",
          "version": "1.2.0",
          "maintainer": "Khoi Hoang \[email protected]\u003e",
          "sentence": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of SAMD21/SAMD51. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.",
          "paragraph": "Useful if the EEPROM is not available or too small. Currently, ATSAMD21 and ATSAMD51 are supported (and consequently every board based on this cpu like the Arduino Zero, Aduino MKR1000, Nano-33 IoT, Itsy-Bitsy M4, etc).",
          "website": "https://github.com/khoih-prog/FlashStorage_SAMD",
          "category": "Data Storage",
          "architectures": [
            "samd"
          ],
          "types": [
            "Contributed"
          ],
          "resources": {
            "url": "https://downloads.arduino.cc/libraries/github.com/khoih-prog/FlashStorage_SAMD-1.2.0.zip",
            "archive_filename": "FlashStorage_SAMD-1.2.0.zip",
            "checksum": "SHA-256:e5b2a7551f5abebeb0fe262eea2e2b30c5616d9f7347305dda0f6543e13c2b19",
            "size": 176309,
            "cache_path": "libraries"
          },
          "license": "MIT",
          "provides_includes": [
            "FlashStorage_SAMD.h"
          ]
        },
        "1.2.1": {
          "author": "Cristian Maglie \[email protected]\u003e, Khoi Hoang \[email protected]\u003e",
          "version": "1.2.1",
          "maintainer": "Khoi Hoang \[email protected]\u003e",
          "sentence": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of SAMD21/SAMD51. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.",
          "paragraph": "Useful if the EEPROM is not available or too small. Currently, ATSAMD21 and ATSAMD51 are supported (and consequently every board based on this cpu like the Arduino Zero, Aduino MKR1000, Nano-33 IoT, Itsy-Bitsy M4, etc).",
          "website": "https://github.com/khoih-prog/FlashStorage_SAMD",
          "category": "Data Storage",
          "architectures": [
            "samd"
          ],
          "types": [
            "Contributed"
          ],
          "resources": {
            "url": "https://downloads.arduino.cc/libraries/github.com/khoih-prog/FlashStorage_SAMD-1.2.1.zip",
            "archive_filename": "FlashStorage_SAMD-1.2.1.zip",
            "checksum": "SHA-256:7095215f5896787e270e541d4ddf7b66d8e7dcc7a7835ef97e645b7622fafea0",
            "size": 292653,
            "cache_path": "libraries"
          },
          "license": "MIT",
          "provides_includes": [
            "FlashStorage_SAMD.h"
          ]
        },
        "1.3.0": {
          "author": "Cristian Maglie \[email protected]\u003e, Khoi Hoang \[email protected]\u003e",
          "version": "1.3.0",
          "maintainer": "Khoi Hoang \[email protected]\u003e",
          "sentence": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of SAMD21/SAMD51. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.",
          "paragraph": "Useful if the EEPROM is not available or too small. Currently, ATSAMD21 and ATSAMD51 are supported (and consequently every board based on this cpu like the Arduino Zero, Aduino MKR1000, Nano-33 IoT, Itsy-Bitsy M4, etc).",
          "website": "https://github.com/khoih-prog/FlashStorage_SAMD",
          "category": "Data Storage",
          "architectures": [
            "samd"
          ],
          "types": [
            "Contributed"
          ],
          "resources": {
            "url": "https://downloads.arduino.cc/libraries/github.com/khoih-prog/FlashStorage_SAMD-1.3.0.zip",
            "archive_filename": "FlashStorage_SAMD-1.3.0.zip",
            "checksum": "SHA-256:864c3b29cbb3a9776dfe2117acf13b1b7b6c5b064ac8f0ef0dda6a4fce71b787",
            "size": 322639,
            "cache_path": "libraries"
          },
          "license": "MIT",
          "provides_includes": [
            "FlashStorage_SAMD.h",
            "FlashStorage_SAMD.hpp"
          ]
        },
        "1.3.1": {
          "author": "Cristian Maglie \[email protected]\u003e, Khoi Hoang \[email protected]\u003e",
          "version": "1.3.1",
          "maintainer": "Khoi Hoang \[email protected]\u003e",
          "sentence": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of SAMD21/SAMD51. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.",
          "paragraph": "Useful if the EEPROM is not available or too small. Currently, ATSAMD21 and ATSAMD51 are supported (and consequently every board based on this cpu like the Arduino Zero, Aduino MKR1000, Nano-33 IoT, Itsy-Bitsy M4, etc).",
          "website": "https://github.com/khoih-prog/FlashStorage_SAMD",
          "category": "Data Storage",
          "architectures": [
            "samd"
          ],
          "types": [
            "Contributed"
          ],
          "resources": {
            "url": "https://downloads.arduino.cc/libraries/github.com/khoih-prog/FlashStorage_SAMD-1.3.1.zip",
            "archive_filename": "FlashStorage_SAMD-1.3.1.zip",
            "checksum": "SHA-256:dc370593812069f5644ca0d6741447fa137b171346a0a6b9fcdf758cc3ee9674",
            "size": 320069,
            "cache_path": "libraries"
          },
          "provides_includes": [
            "FlashStorage_SAMD.h",
            "FlashStorage_SAMD.hpp"
          ]
        },
        "1.3.2": {
          "author": "Cristian Maglie \[email protected]\u003e, Khoi Hoang \[email protected]\u003e",
          "version": "1.3.2",
          "maintainer": "Khoi Hoang \[email protected]\u003e",
          "sentence": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of SAMD21/SAMD51. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.",
          "paragraph": "Useful if the EEPROM is not available or too small. Currently, ATSAMD21 and ATSAMD51 are supported (and consequently every board based on this cpu like the Arduino Zero, Aduino MKR1000, Nano-33 IoT, Itsy-Bitsy M4, etc).",
          "website": "https://github.com/khoih-prog/FlashStorage_SAMD",
          "category": "Data Storage",
          "architectures": [
            "samd"
          ],
          "types": [
            "Contributed"
          ],
          "resources": {
            "url": "https://downloads.arduino.cc/libraries/github.com/khoih-prog/FlashStorage_SAMD-1.3.2.zip",
            "archive_filename": "FlashStorage_SAMD-1.3.2.zip",
            "checksum": "SHA-256:8cc96ce7edcc72f4d776085d951a63deaef6eff5c79c5c4b898a44ed25307c95",
            "size": 323126,
            "cache_path": "libraries"
          },
          "license": "GPLv3",
          "provides_includes": [
            "FlashStorage_SAMD.h",
            "FlashStorage_SAMD.hpp",
            "FlashAsEEPROM_SAMD.h",
            "FlashAsEEPROM_SAMD.hpp"
          ]
        }
      },
      "latest": {
        "author": "Cristian Maglie \[email protected]\u003e, Khoi Hoang \[email protected]\u003e",
        "version": "1.3.2",
        "maintainer": "Khoi Hoang \[email protected]\u003e",
        "sentence": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of SAMD21/SAMD51. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.",
        "paragraph": "Useful if the EEPROM is not available or too small. Currently, ATSAMD21 and ATSAMD51 are supported (and consequently every board based on this cpu like the Arduino Zero, Aduino MKR1000, Nano-33 IoT, Itsy-Bitsy M4, etc).",
        "website": "https://github.com/khoih-prog/FlashStorage_SAMD",
        "category": "Data Storage",
        "architectures": [
          "samd"
        ],
        "types": [
          "Contributed"
        ],
        "resources": {
          "url": "https://downloads.arduino.cc/libraries/github.com/khoih-prog/FlashStorage_SAMD-1.3.2.zip",
          "archive_filename": "FlashStorage_SAMD-1.3.2.zip",
          "checksum": "SHA-256:8cc96ce7edcc72f4d776085d951a63deaef6eff5c79c5c4b898a44ed25307c95",
          "size": 323126,
          "cache_path": "libraries"
        },
        "license": "GPLv3",
        "provides_includes": [
          "FlashStorage_SAMD.h",
          "FlashStorage_SAMD.hpp",
          "FlashAsEEPROM_SAMD.h",
          "FlashAsEEPROM_SAMD.hpp"
        ]
      },
      "available_versions": [
        "1.0.0",
        "1.1.0",
        "1.2.0",
        "1.2.1",
        "1.3.0",
        "1.3.1",
        "1.3.2"
      ]
    }
  ],
  "status": 1
}

What is the new behavior?

$ arduino-cli lib search FlashStorage Cristian --format json --omit-releases-details
{
  "libraries": [
    {
      "name": "FlashStorage_SAMD",
      "latest": {
        "author": "Cristian Maglie \[email protected]\u003e, Khoi Hoang \[email protected]\u003e",
        "version": "1.3.2",
        "maintainer": "Khoi Hoang \[email protected]\u003e",
        "sentence": "The FlashStorage library aims to provide a convenient way to store and retrieve user's data using the non-volatile flash memory of SAMD21/SAMD51. It's using the buffered read and write to minimize the access to Flash. It now supports writing and reading the whole object, not just byte-and-byte.",
        "paragraph": "Useful if the EEPROM is not available or too small. Currently, ATSAMD21 and ATSAMD51 are supported (and consequently every board based on this cpu like the Arduino Zero, Aduino MKR1000, Nano-33 IoT, Itsy-Bitsy M4, etc).",
        "website": "https://github.com/khoih-prog/FlashStorage_SAMD",
        "category": "Data Storage",
        "architectures": [
          "samd"
        ],
        "types": [
          "Contributed"
        ],
        "resources": {
          "url": "https://downloads.arduino.cc/libraries/github.com/khoih-prog/FlashStorage_SAMD-1.3.2.zip",
          "archive_filename": "FlashStorage_SAMD-1.3.2.zip",
          "checksum": "SHA-256:8cc96ce7edcc72f4d776085d951a63deaef6eff5c79c5c4b898a44ed25307c95",
          "size": 323126,
          "cache_path": "libraries"
        },
        "license": "GPLv3",
        "provides_includes": [
          "FlashStorage_SAMD.h",
          "FlashStorage_SAMD.hpp",
          "FlashAsEEPROM_SAMD.h",
          "FlashAsEEPROM_SAMD.hpp"
        ]
      },
      "available_versions": [
        "1.0.0",
        "1.1.0",
        "1.2.0",
        "1.2.1",
        "1.3.0",
        "1.3.1",
        "1.3.2"
      ]
    }
  ],
  "status": 1
}

Does this PR introduce a breaking change, and is titled accordingly?

No

Other information

Fix #2064

@cmaglie cmaglie self-assigned this Mar 9, 2023
@cmaglie cmaglie added type: enhancement Proposed improvement topic: gRPC Related to the gRPC interface labels Mar 9, 2023
@cmaglie cmaglie requested review from umbynos, Bikappa and kittaakos March 9, 2023 14:50
@codecov
Copy link

codecov bot commented Mar 9, 2023

Codecov Report

Patch coverage: 70.00% and project coverage change: +0.06 🎉

Comparison is base (fed439a) 36.45% compared to head (7a800ce) 36.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2102      +/-   ##
==========================================
+ Coverage   36.45%   36.51%   +0.06%     
==========================================
  Files         229      229              
  Lines       19587    19593       +6     
==========================================
+ Hits         7140     7154      +14     
+ Misses      11610    11603       -7     
+ Partials      837      836       -1     
Flag Coverage Δ
unit 36.51% <70.00%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
internal/cli/lib/search.go 0.00% <0.00%> (ø)
commands/lib/search.go 93.10% <100.00%> (+0.99%) ⬆️
arduino/cores/packagemanager/package_manager.go 71.07% <0.00%> (+0.61%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@per1234 per1234 added topic: code Related to content of the project itself topic: CLI Related to the command line interface labels Mar 13, 2023
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Cristian!

Copy link
Contributor

@kittaakos kittaakos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Cristian!

It's working great in IDE2: arduino/arduino-ide#1949.

@cmaglie cmaglie merged commit 71a8576 into arduino:master Mar 13, 2023
@cmaglie cmaglie deleted the slim_lib_search branch March 13, 2023 09:32
kittaakos pushed a commit to kittaakos/arduino-cli that referenced this pull request Mar 21, 2023
* Added flag to LibrarySearchRequest gRPC API to reduce response output

* Added --omit-releases-details flag in 'lib search'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to the command line interface topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider introducing a new lib search flag to omit the details for all releases from the response
3 participants