13
13
// Arduino software without disclosing the source code of your own applications.
14
14
// To purchase a commercial license, send an email to [email protected] .
15
15
16
- package daemon
16
+ package commands
17
17
18
18
import (
19
19
"context"
@@ -22,16 +22,12 @@ import (
22
22
"io"
23
23
"sync/atomic"
24
24
25
- "github.com/arduino/arduino-cli/commands"
26
25
"github.com/arduino/arduino-cli/commands/board"
27
26
"github.com/arduino/arduino-cli/commands/cmderrors"
28
27
"github.com/arduino/arduino-cli/commands/compile"
29
- "github.com/arduino/arduino-cli/commands/core"
30
- "github.com/arduino/arduino-cli/commands/lib"
31
28
"github.com/arduino/arduino-cli/commands/monitor"
32
29
"github.com/arduino/arduino-cli/commands/sketch"
33
30
"github.com/arduino/arduino-cli/commands/upload"
34
- "github.com/arduino/arduino-cli/internal/i18n"
35
31
rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
36
32
"github.com/sirupsen/logrus"
37
33
"google.golang.org/grpc/metadata"
@@ -45,8 +41,6 @@ type ArduinoCoreServerImpl struct {
45
41
VersionString string
46
42
}
47
43
48
- var tr = i18n .Tr
49
-
50
44
func convertErrorToRPCStatus (err error ) error {
51
45
if err == nil {
52
46
return nil
@@ -76,13 +70,13 @@ func (s *ArduinoCoreServerImpl) BoardList(ctx context.Context, req *rpc.BoardLis
76
70
77
71
// BoardListAll FIXMEDOC
78
72
func (s * ArduinoCoreServerImpl ) BoardListAll (ctx context.Context , req * rpc.BoardListAllRequest ) (* rpc.BoardListAllResponse , error ) {
79
- resp , err := board . ListAll (ctx , req )
73
+ resp , err := BoardListAll (ctx , req )
80
74
return resp , convertErrorToRPCStatus (err )
81
75
}
82
76
83
77
// BoardSearch exposes to the gRPC interface the board search command
84
78
func (s * ArduinoCoreServerImpl ) BoardSearch (ctx context.Context , req * rpc.BoardSearchRequest ) (* rpc.BoardSearchResponse , error ) {
85
- resp , err := board . Search (ctx , req )
79
+ resp , err := BoardSearch (ctx , req )
86
80
return resp , convertErrorToRPCStatus (err )
87
81
}
88
82
@@ -114,14 +108,14 @@ func (s *ArduinoCoreServerImpl) BoardListWatch(req *rpc.BoardListWatchRequest, s
114
108
115
109
// Destroy FIXMEDOC
116
110
func (s * ArduinoCoreServerImpl ) Destroy (ctx context.Context , req * rpc.DestroyRequest ) (* rpc.DestroyResponse , error ) {
117
- resp , err := commands . Destroy (ctx , req )
111
+ resp , err := Destroy (ctx , req )
118
112
return resp , convertErrorToRPCStatus (err )
119
113
}
120
114
121
115
// UpdateIndex FIXMEDOC
122
116
func (s * ArduinoCoreServerImpl ) UpdateIndex (req * rpc.UpdateIndexRequest , stream rpc.ArduinoCoreService_UpdateIndexServer ) error {
123
117
syncSend := NewSynchronizedSend (stream .Send )
124
- err := commands . UpdateIndex (stream .Context (), req ,
118
+ err := UpdateIndex (stream .Context (), req ,
125
119
func (p * rpc.DownloadProgress ) { syncSend .Send (& rpc.UpdateIndexResponse {DownloadProgress : p }) },
126
120
)
127
121
return convertErrorToRPCStatus (err )
@@ -130,7 +124,7 @@ func (s *ArduinoCoreServerImpl) UpdateIndex(req *rpc.UpdateIndexRequest, stream
130
124
// UpdateLibrariesIndex FIXMEDOC
131
125
func (s * ArduinoCoreServerImpl ) UpdateLibrariesIndex (req * rpc.UpdateLibrariesIndexRequest , stream rpc.ArduinoCoreService_UpdateLibrariesIndexServer ) error {
132
126
syncSend := NewSynchronizedSend (stream .Send )
133
- err := commands . UpdateLibrariesIndex (stream .Context (), req ,
127
+ err := UpdateLibrariesIndex (stream .Context (), req ,
134
128
func (p * rpc.DownloadProgress ) { syncSend .Send (& rpc.UpdateLibrariesIndexResponse {DownloadProgress : p }) },
135
129
)
136
130
return convertErrorToRPCStatus (err )
@@ -145,14 +139,14 @@ func (s *ArduinoCoreServerImpl) Create(ctx context.Context, req *rpc.CreateReque
145
139
if len (userAgent ) == 0 {
146
140
userAgent = []string {"gRPCClientUnknown/0.0.0" }
147
141
}
148
- res , err := commands . Create (req , userAgent ... )
142
+ res , err := Create (req , userAgent ... )
149
143
return res , convertErrorToRPCStatus (err )
150
144
}
151
145
152
146
// Init FIXMEDOC
153
147
func (s * ArduinoCoreServerImpl ) Init (req * rpc.InitRequest , stream rpc.ArduinoCoreService_InitServer ) error {
154
148
syncSend := NewSynchronizedSend (stream .Send )
155
- err := commands . Init (req , func (message * rpc.InitResponse ) { syncSend .Send (message ) })
149
+ err := Init (req , func (message * rpc.InitResponse ) { syncSend .Send (message ) })
156
150
return convertErrorToRPCStatus (err )
157
151
}
158
152
@@ -217,7 +211,7 @@ func (s *ArduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
217
211
// PlatformInstall FIXMEDOC
218
212
func (s * ArduinoCoreServerImpl ) PlatformInstall (req * rpc.PlatformInstallRequest , stream rpc.ArduinoCoreService_PlatformInstallServer ) error {
219
213
syncSend := NewSynchronizedSend (stream .Send )
220
- resp , err := core . PlatformInstall (
214
+ resp , err := PlatformInstall (
221
215
stream .Context (), req ,
222
216
func (p * rpc.DownloadProgress ) { syncSend .Send (& rpc.PlatformInstallResponse {Progress : p }) },
223
217
func (p * rpc.TaskProgress ) { syncSend .Send (& rpc.PlatformInstallResponse {TaskProgress : p }) },
@@ -231,7 +225,7 @@ func (s *ArduinoCoreServerImpl) PlatformInstall(req *rpc.PlatformInstallRequest,
231
225
// PlatformDownload FIXMEDOC
232
226
func (s * ArduinoCoreServerImpl ) PlatformDownload (req * rpc.PlatformDownloadRequest , stream rpc.ArduinoCoreService_PlatformDownloadServer ) error {
233
227
syncSend := NewSynchronizedSend (stream .Send )
234
- resp , err := core . PlatformDownload (
228
+ resp , err := PlatformDownload (
235
229
stream .Context (), req ,
236
230
func (p * rpc.DownloadProgress ) { syncSend .Send (& rpc.PlatformDownloadResponse {Progress : p }) },
237
231
)
@@ -244,7 +238,7 @@ func (s *ArduinoCoreServerImpl) PlatformDownload(req *rpc.PlatformDownloadReques
244
238
// PlatformUninstall FIXMEDOC
245
239
func (s * ArduinoCoreServerImpl ) PlatformUninstall (req * rpc.PlatformUninstallRequest , stream rpc.ArduinoCoreService_PlatformUninstallServer ) error {
246
240
syncSend := NewSynchronizedSend (stream .Send )
247
- resp , err := core . PlatformUninstall (
241
+ resp , err := PlatformUninstall (
248
242
stream .Context (), req ,
249
243
func (p * rpc.TaskProgress ) { syncSend .Send (& rpc.PlatformUninstallResponse {TaskProgress : p }) },
250
244
)
@@ -257,7 +251,7 @@ func (s *ArduinoCoreServerImpl) PlatformUninstall(req *rpc.PlatformUninstallRequ
257
251
// PlatformUpgrade FIXMEDOC
258
252
func (s * ArduinoCoreServerImpl ) PlatformUpgrade (req * rpc.PlatformUpgradeRequest , stream rpc.ArduinoCoreService_PlatformUpgradeServer ) error {
259
253
syncSend := NewSynchronizedSend (stream .Send )
260
- resp , err := core . PlatformUpgrade (
254
+ resp , err := PlatformUpgrade (
261
255
stream .Context (), req ,
262
256
func (p * rpc.DownloadProgress ) { syncSend .Send (& rpc.PlatformUpgradeResponse {Progress : p }) },
263
257
func (p * rpc.TaskProgress ) { syncSend .Send (& rpc.PlatformUpgradeResponse {TaskProgress : p }) },
@@ -270,7 +264,7 @@ func (s *ArduinoCoreServerImpl) PlatformUpgrade(req *rpc.PlatformUpgradeRequest,
270
264
271
265
// PlatformSearch FIXMEDOC
272
266
func (s * ArduinoCoreServerImpl ) PlatformSearch (ctx context.Context , req * rpc.PlatformSearchRequest ) (* rpc.PlatformSearchResponse , error ) {
273
- resp , err := core . PlatformSearch (req )
267
+ resp , err := PlatformSearch (req )
274
268
return resp , convertErrorToRPCStatus (err )
275
269
}
276
270
@@ -367,7 +361,7 @@ func (s *ArduinoCoreServerImpl) ListProgrammersAvailableForUpload(ctx context.Co
367
361
// LibraryDownload FIXMEDOC
368
362
func (s * ArduinoCoreServerImpl ) LibraryDownload (req * rpc.LibraryDownloadRequest , stream rpc.ArduinoCoreService_LibraryDownloadServer ) error {
369
363
syncSend := NewSynchronizedSend (stream .Send )
370
- resp , err := lib . LibraryDownload (
364
+ resp , err := LibraryDownload (
371
365
stream .Context (), req ,
372
366
func (p * rpc.DownloadProgress ) { syncSend .Send (& rpc.LibraryDownloadResponse {Progress : p }) },
373
367
)
@@ -380,7 +374,7 @@ func (s *ArduinoCoreServerImpl) LibraryDownload(req *rpc.LibraryDownloadRequest,
380
374
// LibraryInstall FIXMEDOC
381
375
func (s * ArduinoCoreServerImpl ) LibraryInstall (req * rpc.LibraryInstallRequest , stream rpc.ArduinoCoreService_LibraryInstallServer ) error {
382
376
syncSend := NewSynchronizedSend (stream .Send )
383
- err := lib . LibraryInstall (
377
+ err := LibraryInstall (
384
378
stream .Context (), req ,
385
379
func (p * rpc.DownloadProgress ) { syncSend .Send (& rpc.LibraryInstallResponse {Progress : p }) },
386
380
func (p * rpc.TaskProgress ) { syncSend .Send (& rpc.LibraryInstallResponse {TaskProgress : p }) },
@@ -391,7 +385,7 @@ func (s *ArduinoCoreServerImpl) LibraryInstall(req *rpc.LibraryInstallRequest, s
391
385
// LibraryUpgrade FIXMEDOC
392
386
func (s * ArduinoCoreServerImpl ) LibraryUpgrade (req * rpc.LibraryUpgradeRequest , stream rpc.ArduinoCoreService_LibraryUpgradeServer ) error {
393
387
syncSend := NewSynchronizedSend (stream .Send )
394
- err := lib . LibraryUpgrade (
388
+ err := LibraryUpgrade (
395
389
stream .Context (), req ,
396
390
func (p * rpc.DownloadProgress ) { syncSend .Send (& rpc.LibraryUpgradeResponse {Progress : p }) },
397
391
func (p * rpc.TaskProgress ) { syncSend .Send (& rpc.LibraryUpgradeResponse {TaskProgress : p }) },
@@ -402,7 +396,7 @@ func (s *ArduinoCoreServerImpl) LibraryUpgrade(req *rpc.LibraryUpgradeRequest, s
402
396
// LibraryUninstall FIXMEDOC
403
397
func (s * ArduinoCoreServerImpl ) LibraryUninstall (req * rpc.LibraryUninstallRequest , stream rpc.ArduinoCoreService_LibraryUninstallServer ) error {
404
398
syncSend := NewSynchronizedSend (stream .Send )
405
- err := lib . LibraryUninstall (stream .Context (), req ,
399
+ err := LibraryUninstall (stream .Context (), req ,
406
400
func (p * rpc.TaskProgress ) { syncSend .Send (& rpc.LibraryUninstallResponse {TaskProgress : p }) },
407
401
)
408
402
return convertErrorToRPCStatus (err )
@@ -411,7 +405,7 @@ func (s *ArduinoCoreServerImpl) LibraryUninstall(req *rpc.LibraryUninstallReques
411
405
// LibraryUpgradeAll FIXMEDOC
412
406
func (s * ArduinoCoreServerImpl ) LibraryUpgradeAll (req * rpc.LibraryUpgradeAllRequest , stream rpc.ArduinoCoreService_LibraryUpgradeAllServer ) error {
413
407
syncSend := NewSynchronizedSend (stream .Send )
414
- err := lib . LibraryUpgradeAll (req ,
408
+ err := LibraryUpgradeAll (req ,
415
409
func (p * rpc.DownloadProgress ) { syncSend .Send (& rpc.LibraryUpgradeAllResponse {Progress : p }) },
416
410
func (p * rpc.TaskProgress ) { syncSend .Send (& rpc.LibraryUpgradeAllResponse {TaskProgress : p }) },
417
411
)
@@ -420,19 +414,19 @@ func (s *ArduinoCoreServerImpl) LibraryUpgradeAll(req *rpc.LibraryUpgradeAllRequ
420
414
421
415
// LibraryResolveDependencies FIXMEDOC
422
416
func (s * ArduinoCoreServerImpl ) LibraryResolveDependencies (ctx context.Context , req * rpc.LibraryResolveDependenciesRequest ) (* rpc.LibraryResolveDependenciesResponse , error ) {
423
- resp , err := lib . LibraryResolveDependencies (ctx , req )
417
+ resp , err := LibraryResolveDependencies (ctx , req )
424
418
return resp , convertErrorToRPCStatus (err )
425
419
}
426
420
427
421
// LibrarySearch FIXMEDOC
428
422
func (s * ArduinoCoreServerImpl ) LibrarySearch (ctx context.Context , req * rpc.LibrarySearchRequest ) (* rpc.LibrarySearchResponse , error ) {
429
- resp , err := lib . LibrarySearch (ctx , req )
423
+ resp , err := LibrarySearch (ctx , req )
430
424
return resp , convertErrorToRPCStatus (err )
431
425
}
432
426
433
427
// LibraryList FIXMEDOC
434
428
func (s * ArduinoCoreServerImpl ) LibraryList (ctx context.Context , req * rpc.LibraryListRequest ) (* rpc.LibraryListResponse , error ) {
435
- resp , err := lib . LibraryList (ctx , req )
429
+ resp , err := LibraryList (ctx , req )
436
430
return resp , convertErrorToRPCStatus (err )
437
431
}
438
432
@@ -445,7 +439,7 @@ func (s *ArduinoCoreServerImpl) ArchiveSketch(ctx context.Context, req *rpc.Arch
445
439
// ZipLibraryInstall FIXMEDOC
446
440
func (s * ArduinoCoreServerImpl ) ZipLibraryInstall (req * rpc.ZipLibraryInstallRequest , stream rpc.ArduinoCoreService_ZipLibraryInstallServer ) error {
447
441
syncSend := NewSynchronizedSend (stream .Send )
448
- err := lib . ZipLibraryInstall (
442
+ err := ZipLibraryInstall (
449
443
stream .Context (), req ,
450
444
func (p * rpc.TaskProgress ) { syncSend .Send (& rpc.ZipLibraryInstallResponse {TaskProgress : p }) },
451
445
)
@@ -455,7 +449,7 @@ func (s *ArduinoCoreServerImpl) ZipLibraryInstall(req *rpc.ZipLibraryInstallRequ
455
449
// GitLibraryInstall FIXMEDOC
456
450
func (s * ArduinoCoreServerImpl ) GitLibraryInstall (req * rpc.GitLibraryInstallRequest , stream rpc.ArduinoCoreService_GitLibraryInstallServer ) error {
457
451
syncSend := NewSynchronizedSend (stream .Send )
458
- err := lib . GitLibraryInstall (
452
+ err := GitLibraryInstall (
459
453
stream .Context (), req ,
460
454
func (p * rpc.TaskProgress ) { syncSend .Send (& rpc.GitLibraryInstallResponse {TaskProgress : p }) },
461
455
)
0 commit comments