Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
4d31f4fd
Unverified
Commit
4d31f4fd
authored
Jun 06, 2022
by
Umberto Baldi
Committed by
GitHub
Jun 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix `arduino-cli outdated --format json` output (#1746)
parent
0a1d8eed
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
15 deletions
+32
-15
cli/outdated/outdated.go
cli/outdated/outdated.go
+31
-14
test/test_upgrade.py
test/test_upgrade.py
+1
-1
No files found.
cli/outdated/outdated.go
View file @
4d31f4fd
...
...
@@ -57,25 +57,42 @@ func runOutdatedCommand(cmd *cobra.Command, args []string) {
feedback
.
Errorf
(
tr
(
"Error retrieving outdated cores and libraries: %v"
),
err
)
}
feedback
.
PrintResult
(
outdatedResult
{
Platforms
:
outdatedResp
.
OutdatedPlatforms
,
Libraries
:
outdatedResp
.
OutdatedLibraries
})
}
// output from this command requires special formatting, let's create a dedicated
// feedback.Result implementation
type
outdatedResult
struct
{
Platforms
[]
*
rpc
.
Platform
Libraries
[]
*
rpc
.
InstalledLibrary
}
func
(
or
outdatedResult
)
Data
()
interface
{}
{
return
or
}
func
(
or
outdatedResult
)
String
()
string
{
// Prints outdated cores
t
ab
:=
table
.
New
()
tab
.
SetHeader
(
tr
(
"ID"
),
tr
(
"Installed version"
),
tr
(
"New version"
),
tr
(
"Name"
))
if
len
(
outdatedResp
.
OutdatedPlatforms
)
>
0
{
for
_
,
p
:=
range
o
utdatedResp
.
Outdated
Platforms
{
t
ab
.
AddRow
(
p
.
Id
,
p
.
Installed
,
p
.
Latest
,
p
.
Name
)
t
1
:=
table
.
New
()
if
len
(
or
.
Platforms
)
>
0
{
t1
.
SetHeader
(
tr
(
"ID"
),
tr
(
"Installed version"
),
tr
(
"New version"
),
tr
(
"Name"
))
for
_
,
p
:=
range
o
r
.
Platforms
{
t
1
.
AddRow
(
p
.
Id
,
p
.
Installed
,
p
.
Latest
,
p
.
Name
)
}
feedback
.
Print
(
tab
.
Render
())
}
// Prints outdated libraries
t
ab
=
table
.
New
()
tab
.
SetHeader
(
tr
(
"Library name"
),
tr
(
"Installed version"
),
tr
(
"New version"
))
if
len
(
outdatedResp
.
OutdatedLibraries
)
>
0
{
for
_
,
l
:=
range
o
utdatedResp
.
Outdated
Libraries
{
t
ab
.
AddRow
(
l
.
Library
.
Name
,
l
.
Library
.
Version
,
l
.
Release
.
Version
)
t
2
:
=
table
.
New
()
if
len
(
or
.
Libraries
)
>
0
{
t2
.
SetHeader
(
tr
(
"Library name"
),
tr
(
"Installed version"
),
tr
(
"New version"
))
for
_
,
l
:=
range
o
r
.
Libraries
{
t
2
.
AddRow
(
l
.
Library
.
Name
,
l
.
Library
.
Version
,
l
.
Release
.
Version
)
}
feedback
.
Print
(
tab
.
Render
())
}
logrus
.
Info
(
"Done"
)
if
len
(
or
.
Libraries
)
>
0
&&
len
(
or
.
Platforms
)
>
0
{
return
t1
.
Render
()
+
"
\n
"
+
t2
.
Render
()
// handle the new line between tables
}
return
t1
.
Render
()
+
t2
.
Render
()
}
test/test_upgrade.py
View file @
4d31f4fd
...
...
@@ -42,7 +42,7 @@ def test_upgrade(run_command):
# Verifies cores and libraries have been updated
result
=
run_command
([
"outdated"
])
assert
result
.
ok
assert
result
.
stdout
==
""
assert
result
.
stdout
==
"
\n
"
def
test_upgrade_using_library_with_invalid_version
(
run_command
,
data_dir
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment