Skip to content

Add Sentence field to lib list output #845

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

Merged
merged 3 commits into from
Jul 21, 2020
Merged

Add Sentence field to lib list output #845

merged 3 commits into from
Jul 21, 2020

Conversation

silvanocerza
Copy link
Contributor

Please check if the PR fulfills these requirements

  • 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)

Installed libraries' sentences are now shown in arduino-cli lib list output.

Now:

$ ./arduino-cli lib list
Name         Installed Available Location Sentence                                                                      
ArduinoJson  6.11.0    6.15.2    user     An efficient and elegant JSON library for Arduino.                            
AudioZero    1.1.1     -         user     Allows playing audio files from an SD card. For Arduino Zero and MKR1000 only.
Sodaq_HTS221 1.0.0     -         user     An Arduino library for the HTS221 sensor.                                     

Before:

$ ./arduino-cli lib list
Name         Installed Available Location
ArduinoJson  6.11.0    6.15.2    user
AudioZero    1.1.1     -         user
Sodaq_HTS221 1.0.0     -         user

See how to contribute

Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

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

We don't have limit on the sentence length, I think we should cut if it's too long, for example on my installation I have:

image

so I see two problems:

  1. sentences that are too long will stretch the width of the table too much, in this case I have a single library with a very long sentence and it will create a lot of "empty" space on all the other rows
  2. the same thing happens when a long "version" appears in this case I have 1.15.0-ALPHA-precompiled that stretch the second and third column creating a lot of empty space

I think that both can be easily fixed:

  1. Just cut the sentence if it is too long, I guess 40 chars is enough.
  2. You can set different column width modes, in particular there is the table.Average mode that sets the column witdth to the average length of all the elements listed (and not the max of them), in your case you can set
t.SetColumnWidthMode(1, table.Average)
t.SetColumnWidthMode(2, table.Average)
t.SetColumnWidthMode(4, table.Average)

where column 1, 2 and 4 are the "Installed", "Available" and "Sentence" columns. Doing so will avoid that a single very long element will increase the width too much.

Finally I would change "Sentence" to "Description".

@cmaglie cmaglie added this to the 0.12.0 milestone Jul 21, 2020
Output columns are now smaller, sentence is cut if too long and renamed
Sentence column to Description.
@silvanocerza silvanocerza merged commit 046d2e0 into arduino:master Jul 21, 2020
@silvanocerza silvanocerza deleted the scerza/lib-list-sentence branch July 21, 2020 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants