Skip to content

Commit 13fa409

Browse files
Add Online Help link to gRPC interface's Platform (#2009)
* Add online help field to rpc platform * Add online help field to the output of `core search --format json` * Add tests for the changes
1 parent de90579 commit 13fa409

File tree

4 files changed

+134
-33
lines changed

4 files changed

+134
-33
lines changed

Diff for: commands/core.go

+1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ func PlatformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.Platform
5656
Maintainer: platformRelease.Platform.Package.Maintainer,
5757
Website: platformRelease.Platform.Package.WebsiteURL,
5858
Email: platformRelease.Platform.Package.Email,
59+
Help: &rpc.HelpResources{Online: platformRelease.Platform.Package.Help.Online},
5960
Boards: boards,
6061
Latest: platformRelease.Version.String(),
6162
ManuallyInstalled: platformRelease.Platform.ManuallyInstalled,

Diff for: commands/core/search_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func TestPlatformSearch(t *testing.T) {
6262
6363
Boards: []*rpc.Board{{Name: "RK002"}},
6464
Type: []string{"Contributed"},
65+
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
6566
})
6667
require.Contains(t, res.SearchOutput, &rpc.Platform{
6768
Id: "Retrokits-RK002:arm",
@@ -73,6 +74,7 @@ func TestPlatformSearch(t *testing.T) {
7374
7475
Boards: []*rpc.Board{{Name: "RK002"}},
7576
Type: []string{"Contributed"},
77+
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
7678
})
7779

7880
res, stat = PlatformSearch(&rpc.PlatformSearchRequest{
@@ -93,6 +95,7 @@ func TestPlatformSearch(t *testing.T) {
9395
9496
Boards: []*rpc.Board{{Name: "RK002"}},
9597
Type: []string{"Contributed"},
98+
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
9699
})
97100

98101
// Search the Package Maintainer
@@ -114,6 +117,7 @@ func TestPlatformSearch(t *testing.T) {
114117
115118
Boards: []*rpc.Board{{Name: "RK002"}},
116119
Type: []string{"Contributed"},
120+
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
117121
})
118122
require.Contains(t, res.SearchOutput, &rpc.Platform{
119123
Id: "Retrokits-RK002:arm",
@@ -125,6 +129,7 @@ func TestPlatformSearch(t *testing.T) {
125129
126130
Boards: []*rpc.Board{{Name: "RK002"}},
127131
Type: []string{"Contributed"},
132+
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
128133
})
129134

130135
// Search using the Package name
@@ -146,6 +151,7 @@ func TestPlatformSearch(t *testing.T) {
146151
147152
Boards: []*rpc.Board{{Name: "RK002"}},
148153
Type: []string{"Contributed"},
154+
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
149155
})
150156
require.Contains(t, res.SearchOutput, &rpc.Platform{
151157
Id: "Retrokits-RK002:arm",
@@ -157,6 +163,7 @@ func TestPlatformSearch(t *testing.T) {
157163
158164
Boards: []*rpc.Board{{Name: "RK002"}},
159165
Type: []string{"Contributed"},
166+
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
160167
})
161168

162169
// Search using the Platform name
@@ -178,6 +185,7 @@ func TestPlatformSearch(t *testing.T) {
178185
179186
Boards: []*rpc.Board{{Name: "RK002"}},
180187
Type: []string{"Contributed"},
188+
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
181189
})
182190
require.Contains(t, res.SearchOutput, &rpc.Platform{
183191
Id: "Retrokits-RK002:arm",
@@ -189,6 +197,7 @@ func TestPlatformSearch(t *testing.T) {
189197
190198
Boards: []*rpc.Board{{Name: "RK002"}},
191199
Type: []string{"Contributed"},
200+
Help: &rpc.HelpResources{Online: "https://www.retrokits.com/rk002/arduino"},
192201
})
193202

194203
// Search using a board name
@@ -237,6 +246,7 @@ func TestPlatformSearch(t *testing.T) {
237246
{Name: "Arduino Industrial 101"},
238247
{Name: "Linino One"},
239248
},
249+
Help: &rpc.HelpResources{Online: "http://www.arduino.cc/en/Reference/HomePage"},
240250
})
241251

242252
res, stat = PlatformSearch(&rpc.PlatformSearchRequest{
@@ -284,6 +294,7 @@ func TestPlatformSearch(t *testing.T) {
284294
{Name: "Arduino Industrial 101"},
285295
{Name: "Linino One"},
286296
},
297+
Help: &rpc.HelpResources{Online: "http://www.arduino.cc/en/Reference/HomePage"},
287298
})
288299
}
289300

Diff for: rpc/cc/arduino/cli/commands/v1/common.pb.go

+113-33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: rpc/cc/arduino/cli/commands/v1/common.proto

+9
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ message Platform {
9999
bool deprecated = 10;
100100
// Type of the platform.
101101
repeated string type = 11;
102+
// A URL provided by the author of the platform's package, intended to point
103+
// to their online help service.
104+
HelpResources help = 12;
102105
}
103106

104107
message InstalledPlatformReference {
@@ -126,3 +129,9 @@ message Profile {
126129
// FQBN specified in the profile.
127130
string fqbn = 2;
128131
}
132+
133+
message HelpResources {
134+
// A URL provided by the author of the platform's package, intended to point
135+
// to their online help service.
136+
string online = 1;
137+
}

0 commit comments

Comments
 (0)