Skip to content

Commit 06bcd3f

Browse files
committed
[skip changelog] Fix lib list output
Output columns are now smaller, sentence is cut if too long and renamed Sentence column to Description.
1 parent 4df7850 commit 06bcd3f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

cli/lib/list.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ func (ir installedResult) String() string {
9090
}
9191

9292
t := table.New()
93-
t.SetHeader("Name", "Installed", "Available", "Location", "Sentence")
93+
t.SetHeader("Name", "Installed", "Available", "Location", "Description")
94+
t.SetColumnWidthMode(1, table.Average)
95+
t.SetColumnWidthMode(2, table.Average)
96+
t.SetColumnWidthMode(4, table.Average)
9497

9598
lastName := ""
9699
for _, libMeta := range ir.installedLibs {
@@ -115,7 +118,10 @@ func (ir installedResult) String() string {
115118
sentence := lib.Sentence
116119
if sentence == "" {
117120
sentence = "-"
121+
} else if len(sentence) > 40 {
122+
sentence = sentence[:39] + "…"
118123
}
124+
119125
t.AddRow(name, lib.Version, available, location, sentence)
120126
}
121127
}

test/test_lib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def test_list(run_command):
4646
assert "" != toks[1]
4747
assert "" != toks[2]
4848
# Verifies library sentence
49-
assert "An efficient and elegant JSON library for Arduino." == toks[4]
49+
assert "An efficient and elegant JSON library f…" == toks[4]
5050

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

0 commit comments

Comments
 (0)