Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4df7850

Browse files
committedJul 20, 2020
Add Sentence field to lib list output
1 parent a2f63fb commit 4df7850

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed
 

‎cli/lib/list.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (ir installedResult) String() string {
9090
}
9191

9292
t := table.New()
93-
t.SetHeader("Name", "Installed", "Available", "Location")
93+
t.SetHeader("Name", "Installed", "Available", "Location", "Sentence")
9494

9595
lastName := ""
9696
for _, libMeta := range ir.installedLibs {
@@ -109,11 +109,14 @@ func (ir installedResult) String() string {
109109

110110
if libMeta.GetRelease() != nil {
111111
available := libMeta.GetRelease().GetVersion()
112-
if available != "" {
113-
t.AddRow(name, lib.Version, available, location)
114-
} else {
115-
t.AddRow(name, lib.Version, "-", location)
112+
if available == "" {
113+
available = "-"
116114
}
115+
sentence := lib.Sentence
116+
if sentence == "" {
117+
sentence = "-"
118+
}
119+
t.AddRow(name, lib.Version, available, location, sentence)
117120
}
118121
}
119122

‎test/test_lib.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@ def test_list(run_command):
3939
assert "" == result.stderr
4040
lines = result.stdout.strip().splitlines()
4141
assert 2 == len(lines)
42-
toks = [t.strip() for t in lines[1].split()]
42+
toks = [t.strip() for t in lines[1].split(maxsplit=4)]
43+
# Verifies the expected number of field
44+
assert 5 == len(toks)
4345
# be sure line contain the current version AND the available version
4446
assert "" != toks[1]
4547
assert "" != toks[2]
48+
# Verifies library sentence
49+
assert "An efficient and elegant JSON library for Arduino." == toks[4]
4650

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

0 commit comments

Comments
 (0)
Please sign in to comment.