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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[skip changelog] Fix lib list output
Output columns are now smaller, sentence is cut if too long and renamed
Sentence column to Description.
  • Loading branch information
silvanocerza committed Jul 21, 2020
commit 06bcd3fa975d7525033a89d7e3e327a0a15e41d6
8 changes: 7 additions & 1 deletion cli/lib/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ func (ir installedResult) String() string {
}

t := table.New()
t.SetHeader("Name", "Installed", "Available", "Location", "Sentence")
t.SetHeader("Name", "Installed", "Available", "Location", "Description")
t.SetColumnWidthMode(1, table.Average)
t.SetColumnWidthMode(2, table.Average)
t.SetColumnWidthMode(4, table.Average)

lastName := ""
for _, libMeta := range ir.installedLibs {
Expand All @@ -115,7 +118,10 @@ func (ir installedResult) String() string {
sentence := lib.Sentence
if sentence == "" {
sentence = "-"
} else if len(sentence) > 40 {
sentence = sentence[:39] + "…"
}

t.AddRow(name, lib.Version, available, location, sentence)
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_list(run_command):
assert "" != toks[1]
assert "" != toks[2]
# Verifies library sentence
assert "An efficient and elegant JSON library for Arduino." == toks[4]
assert "An efficient and elegant JSON library f…" == toks[4]

# Look at the JSON output
result = run_command("lib list --format json")
Expand Down