-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy patharduino-cli.ts
1638 lines (1632 loc) · 47.2 KB
/
arduino-cli.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
const FQBNs: Fig.Generator = {
script: ["arduino-cli", "board", "list", "--format", "json"],
postProcess: (output) => {
try {
const parsedOutput = JSON.parse(output);
const result = parsedOutput
.filter((entry) => entry.matching_boards)
.map((entry) => ({
name: entry.matching_boards[0].fqbn,
description: `${entry.matching_boards[0].name} on port ${entry.port.address}`,
}));
return result;
} catch (error) {
return [];
}
},
};
const Ports: Fig.Generator = {
script: ["arduino-cli", "board", "list", "--format", "json"],
postProcess: (output) => {
try {
const parsedOutput = JSON.parse(output);
const result = parsedOutput
.filter((entry) => entry.matching_boards)
.map((entry) => ({
name: entry.port.address,
description: `${entry.matching_boards[0].name} port connection`,
}));
return result;
} catch (error) {
return [];
}
},
};
const completionSpec: Fig.Spec = {
name: "arduino-cli",
description: "Arduino Command Line Interface",
subcommands: [
{
name: "board",
description: "Arduino board commands",
args: {
name: "attach, list...",
isOptional: true,
},
subcommands: [
{
name: "attach",
description:
"Sets the default values for port and FQBN. If no port or FQBN are specified, the current default port and FQBN are displayed",
options: [
{
name: "--board-options",
description:
"List of board options separated by commas. Or can be used multiple times for multiple options",
args: {},
},
{
name: "--discovery-timeout",
description:
"Max time to wait for port discovery, example: '30s, 1m (default 1s)'",
args: {
name: "duration",
},
},
{
name: ["-b", "--fqbn"],
description:
"Fully Qualified Board Name, example: 'arduino:avr:uno'",
args: {
name: "FQBN",
description: "Fully qualified board name",
generators: FQBNs,
},
},
{
name: ["-h", "--help"],
description: "Help for attach",
},
{
name: ["-p", "--port"],
description:
"Upload port address, example: 'COM3 or /dev/ttyACM2'",
args: {
name: "port",
description: "Arduino board port connection",
generators: Ports,
},
},
{
name: ["-l", "--protocol"],
description: "Upload port protocol, example: 'serial'",
args: {
name: "protocol",
},
},
],
},
{
name: "details",
description:
"Show information about a board, in particular if the board has options to be specified in the FQBN'",
options: [
{
name: "--board-options",
description:
"List of board options separated by commas. Or can be used multiple times for multiple options",
args: {},
},
{
name: ["-b", "--fqbn"],
description:
"Fully Qualified Board Name, example: 'arduino:avr:uno'",
args: {
name: "FQBN",
description: "Fully qualified board name",
generators: FQBNs,
},
},
{
name: ["-f", "--full"],
description: "Show full board details",
},
{
name: ["-h", "--help"],
description: "Help for details",
},
{
name: "--list-programmers",
description: "Show list of available programmers",
},
{
name: "--show-properties",
description:
'Show build properties. The properties are expanded, use "--show-properties=unexpanded" if you want them exactly as they are defined. (default "disabled")',
args: {},
},
],
},
{
name: "list",
description:
"Detects and displays a list of boards connected to the current computer",
options: [
{
name: "--board-options",
description:
"List of board options separated by commas. Or can be used multiple times for multiple options",
args: {},
},
{
name: "--discovery-timeout",
description:
"Max time to wait for port discovery, example: '30s, 1m (default 1s)'",
args: {
name: "duration",
},
},
{
name: ["-b", "--fqbn"],
description:
"Fully Qualified Board Name, example: 'arduino:avr:uno'",
args: {
name: "FQBN",
description: "Fully qualified board name",
generators: FQBNs,
},
},
{
name: ["-h", "--help"],
description: "Help for list",
},
{
name: ["-w", "--watch"],
description:
"Command keeps running and prints list of connected boards whenever there is a change",
args: {},
},
],
},
{
name: "listall",
description:
"List all boards that have the support platform installed, You can search for a specific board if you specify the board name",
options: [
{
name: ["-h", "--help"],
description: "Help for listall",
},
{
name: ["-a", "--show-hidden"],
description:
"Show also boards marked as 'hidden' in the platform",
},
],
},
{
name: "search",
description:
"Search for a board in the Boards Manager using the specified keywords",
options: [
{
name: ["-h", "--help"],
description: "Help for search",
},
{
name: ["-a", "--show-hidden"],
description:
"Show also boards marked as 'hidden' in the platform",
},
],
},
],
options: [
{
name: ["-h", "--help"],
description: "Help for board",
},
],
},
{
name: "burn-bootloader",
description:
"Upload the bootloader on the board using an external programmer",
options: [
{
name: "--board-options",
description:
"List of board options separated by commas. Or can be used multiple times for multiple options",
args: {},
},
{
name: "--discovery-timeout",
description:
"Max time to wait for port discovery, example: '30s, 1m (default 1s)'",
args: {
name: "duration",
},
},
{
name: ["-b", "--fqbn"],
description: "Fully Qualified Board Name, example: 'arduino:avr:uno'",
args: {
name: "FQBN",
description: "Fully qualified board name",
generators: FQBNs,
},
},
{
name: ["-h", "--help"],
description: "Help for burn-bootloader",
},
{
name: ["-p", "--port"],
description: "Upload port address, example: 'COM3 or /dev/ttyACM2'",
args: {
name: "port",
description: "Arduino board port connection",
generators: Ports,
},
},
{
name: ["-P", "--programmer"],
description: "Programmer to use, example: 'atmel_ice'",
args: {},
},
{
name: ["-l", "--protocol"],
description: "Upload port protocol, example: 'serial'",
args: {},
},
{
name: ["-v", "--verbose"],
description: "Turns on verbose mode",
},
{
name: ["-t", "--verify"],
description: "Verify uploaded binary after upload",
},
],
},
{
name: "cache",
description: "Arduino cache commands",
args: {
name: "clean",
isOptional: true,
},
subcommands: [
{
name: "clean",
description:
"Delete contents of the directories.downloads folder, where archive files are staged during installation of libraries and boards platforms",
options: [
{
name: ["-h", "--help"],
description: "Help for clean",
},
],
},
],
options: [
{
name: ["-h", "--help"],
description: "Help for cache",
},
],
},
{
name: "compile",
description: "Compiles Arduino sketches",
options: [
{
name: "--board-options",
description:
"List of board options separated by commas. Or can be used multiple times for multiple option",
args: {},
},
{
name: "--build-cache-path",
description:
"Builds of 'core.a' are saved into this path to be cached and reused",
args: {},
},
{
name: "--build-path",
description:
"Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS",
args: {
name: "filepath",
template: "filepaths",
},
},
{
name: "--build-property",
description:
"Override a build property with a custom value. Can be used multiple times for multiple properties",
args: {},
},
{
name: "--clean",
description:
"Optional, cleanup the build folder and do not use any cached build",
},
{
name: "--discovery-timeout",
description:
"Max time to wait for port discovery, example: '30s, 1m (default 1s)'",
args: {
name: "duration",
},
},
{
name: "--dump-profile",
description:
"Create and print a profile configuration from the build",
},
{
name: "--encrypt-key",
description:
"The name of the custom encryption key to use to encrypt a binary during the compile process. Used only by the platforms that support it",
args: {},
},
{
name: ["e", "--export-binaries"],
description:
"If set built binaries will be exported to the sketch folder",
},
{
name: ["-b", "--fqbn"],
description: "Fully Qualified Board Name, example: 'arduino:avr:uno'",
args: {
name: "FQBN",
description: "Fully qualified board name",
generators: FQBNs,
},
},
{
name: ["-h", "--help"],
description: "Help for compile",
},
{
name: "--keys-keychain",
description:
"The path of the dir to search for the custom keys to sign and encrypt a binary. Used only by the platforms that support it",
args: {
name: "filepath",
template: ["filepaths", "folders"],
},
},
{
name: "--libraries",
description:
"Path to a collection of libraries. Can be used multiple times or entries can be comma separated",
args: {
name: "filepath",
template: ["filepaths", "folders"],
},
},
{
name: "--library",
description:
"Path to a single library’s root folder. Can be used multiple times or entries can be comma separated",
args: {
name: "filepath",
template: ["filepaths", "folders"],
},
},
{
name: "--only-compilation-database",
description:
"Just produce the compilation database, without actually compiling. All build commands are skipped except pre* hooks",
},
{
name: "--optimize-for-debug",
description:
"Optional, optimize compile output for debugging, rather than for release",
},
{
name: "--output-dir",
description: "Save build artifacts in this directory",
args: {
name: "directory",
template: "folders",
},
},
{
name: ["-p", "--port"],
description: "Upload port address, example: 'COM3 or /dev/ttyACM2'",
args: {
name: "port",
description: "Arduino board port connection",
generators: Ports,
},
},
{
name: "--preprocess",
description: "Print preprocessed code to stdout instead of compiling",
},
{
name: ["-m", "--profile"],
description: "Sketch profile to use",
args: {},
},
{
name: ["-P", "--programmer"],
description: "Programmer to use, example: 'atmel_ice'",
args: {},
},
{
name: ["-l", "--protocol"],
description: "Upload port protocol, example: 'serial'",
args: {},
},
{
name: "--quiet",
description: "Optional, suppresses almost every output",
},
{
name: "--show-properties",
description:
'Show build properties. The properties are expanded, use "--show-properties=unexpanded" if you want them exactly as they are defined. (default "disabled")',
args: {},
},
{
name: "--sign-key",
description:
"The name of the custom signing key to use to sign a binary during the compile process. Used only by the platforms that support it",
args: {},
},
{
name: ["-u", "--upload"],
description: "Upload the binary after the compilation",
},
{
name: ["-v", "--verbose"],
description: "Optional, turns on verbose mode",
},
{
name: ["-t", "--verify"],
description: "Verify uploaded binary after the upload",
},
{
name: "--warnings",
description:
'Optional, can be: none, default, more, all. Used to tell gcc which warning level to use (-W flag). (default "none")',
args: {
suggestions: [
{
name: "none",
description: "Use warning level 'none'",
icon: "fig://icon?type=alert",
},
{
name: "default",
description: "Use warning level 'default'",
icon: "fig://icon?type=alert",
},
{
name: "more",
description: "Use warning level 'more'",
icon: "fig://icon?type=alert",
},
{
name: "all",
description: "Use warning level 'all'",
icon: "fig://icon?type=alert",
},
],
default: "none",
},
},
],
},
{
name: "completion",
description: "Generates completion scripts for various shells",
options: [
{
name: ["-h", "--help"],
description: "Help for completion",
},
{
name: "--no-description",
description:
"Disable completion description for shells that support it",
},
],
},
{
name: "config",
description: "Arduino configuration commands",
args: {
name: "init, dump...",
isOptional: true,
},
subcommands: [
{
name: "add",
description: "Adds one or more values to a setting",
options: [
{
name: ["-h", "--help"],
description: "Help for add",
},
],
},
{
name: "delete",
description: "Deletes a settings key and all its sub keys",
options: [
{
name: ["-h", "--help"],
description: "Help for delete",
},
],
},
{
name: "dump",
description: "Prints the current configuration",
options: [
{
name: ["-h", "--help"],
description: "Help for dump",
},
],
},
{
name: "init",
description:
"Creates or updates the configuration file in the data directory or custom directory with the current configuration settings",
options: [
{
name: "--dest-dir",
description: "Sets where to save the configuration file",
args: {
name: "directory",
template: "folders",
},
},
{
name: "--dest-file",
description: "Sets where to save the configuration file",
args: {
name: "file",
template: "filepaths",
},
},
{
name: ["-h", "--help"],
description: "Help for init",
},
{
name: "--overwrite",
description: "Overwrite existing config file",
},
],
},
{
name: "remove",
description: "Removes one or more values from a setting",
options: [
{
name: ["-h", "--help"],
description: "Help for remove",
},
],
},
{
name: "set",
description: "Sets a setting value",
options: [
{
name: ["-h", "--help"],
description: "Help for set",
},
],
},
],
options: [
{
name: ["-h", "--help"],
description: "Help for config",
},
],
},
{
name: "core",
description: "Arduino core operations",
args: {
name: "install, list...",
isOptional: true,
},
subcommands: [
{
name: "download",
description:
"Downloads one or more cores and corresponding tool dependencies",
options: [
{
name: ["-h", "--help"],
description: "Help for download",
},
],
},
{
name: "install",
description:
"Installs one or more cores and corresponding tool dependencies",
options: [
{
name: ["-h", "--help"],
description: "Help for install",
},
{
name: "--no-overwrite",
description: "Do not overwrite already installed platforms",
},
{
name: "--run-post-install",
description:
"Force run of post-install scripts (if the CLI is not running interactively)",
},
{
name: "--run-pre-uninstall",
description:
"Force run of pre-uninstall scripts (if the CLI is not running interactively)",
},
{
name: "--skip-post-install",
description:
"Force skip of post-install scripts (if the CLI is running interactively)",
},
{
name: "--skip-pre-uninstall",
description:
"Force skip of pre-uninstall scripts (if the CLI is running interactively)",
},
],
},
{
name: "list",
description: "Show the list of installed platforms",
options: [
{
name: "all",
description:
"If set return all installable and installed cores, including manually installed",
},
{
name: ["-h", "--help"],
description: "Help for list",
},
{
name: "--updatable",
description: "List updatable platforms",
},
],
},
{
name: "search",
description:
"Search for a core in Boards Manager using the specified keywords",
options: [
{
name: "all",
description: "Show all available core versions",
},
{
name: ["-h", "--help"],
description: "Help for search",
},
],
},
{
name: "uninstall",
description:
"Uninstalls one or more cores and corresponding tool dependencies if no longer used",
options: [
{
name: ["-h", "--help"],
description: "Help for uninstall",
},
{
name: "--run-post-install",
description:
"Force run of post-install scripts (if the CLI is not running interactively)",
},
{
name: "--run-pre-uninstall",
description:
"Force run of pre-uninstall scripts (if the CLI is not running interactively)",
},
{
name: "--skip-post-install",
description:
"Force skip of post-install scripts (if the CLI is running interactively)",
},
{
name: "--skip-pre-uninstall",
description:
"Force skip of pre-uninstall scripts (if the CLI is running interactively)",
},
],
},
{
name: "update-index",
description: "Updates the index of cores to the latest version",
options: [
{
name: ["-h", "--help"],
description: "Help for update-index",
},
],
},
{
name: "upgrade",
description:
"Upgrades one or all installed platforms to the latest version",
options: [
{
name: ["-h", "--help"],
description: "Help for upgrade",
},
{
name: "--run-post-install",
description:
"Force run of post-install scripts (if the CLI is not running interactively)",
},
{
name: "--run-pre-uninstall",
description:
"Force run of pre-uninstall scripts (if the CLI is not running interactively)",
},
{
name: "--skip-post-install",
description:
"Force skip of post-install scripts (if the CLI is running interactively)",
},
{
name: "--skip-pre-uninstall",
description:
"Force skip of pre-uninstall scripts (if the CLI is running interactively)",
},
],
},
],
options: [
{
name: ["-h", "--help"],
description: "Help for core",
},
],
},
{
name: "daemon",
description:
"Run as a daemon on port: 50051, the initialization of cores and libraries is done only once",
options: [
{
name: "--daemonize",
description:
"Do not terminate daemon process if the parent process dies",
},
{
name: "--debug",
description: "Enable debug logging of gRPC calls",
},
{
name: "--debug-file",
description: "Append debug logging to the specified file",
args: {
name: "file",
template: "filepaths",
},
},
{
name: "--debug-filter",
description: "Display only the provided gRPC calls",
args: {},
},
{
name: ["-h", "--help"],
description: "Help for daemon",
},
{
name: "--port",
description: "The TCP port the daemon will listen to",
args: {
name: "port",
description: "Arduino board port connection",
generators: Ports,
},
},
],
},
{
name: "debug",
description:
"Debug Arduino sketches. (this command opens an interactive gdb session)",
args: {
name: "check",
isOptional: true,
},
subcommands: [
{
name: "check",
description:
"Check if the given board/programmer combination supports debugging",
options: [
{
name: "--board-options",
description:
"List of board options separated by commas. Or can be used multiple times for multiple options",
args: {},
},
{
name: "--discovery-timeout",
description:
"Max time to wait for port discovery, example: '30s, 1m (default 1s)'",
args: {
name: "duration",
},
},
{
name: ["-b", "--fqbn"],
description:
"Fully Qualified Board Name, example: 'arduino:avr:uno'",
args: {
name: "FQBN",
description: "Fully qualified board name",
generators: FQBNs,
},
},
{
name: ["-h", "--help"],
description: "Help for check",
},
{
name: "--interpreter",
description:
'Debug interpreter, example: console, mi, mi1, mi2, mi3 (default "console")',
args: {
suggestions: [
{
name: "console",
description: "Debug interpreter 'console'",
},
{
name: "mi",
description: "Debug interpreter 'mi'",
},
{
name: "mi1",
description: "Debug interpreter 'mi1'",
},
{
name: "mi2",
description: "Debug interpreter 'mi2'",
},
{
name: "mi3",
description: "Debug interpreter 'mi3'",
},
],
default: "console",
},
},
{
name: ["-p", "--port"],
description:
"Upload port address, example: 'COM3 or /dev/ttyACM2'",
args: {
name: "port",
description: "Arduino board port connection",
generators: Ports,
},
},
{
name: ["-P", "--programmer"],
description: "Programmer to use, example: 'atmel_ice'",
args: {},
},
{
name: ["-l", "--protocol"],
description: "Upload port protocol, example: 'serial'",
args: {},
},
],
},
],
options: [
{
name: "--board-options",
description:
"List of board options separated by commas. Or can be used multiple times for multiple options",
args: {},
},
{
name: "--discovery-timeout",
description:
"Max time to wait for port discovery, example: '30s, 1m (default 1s)'",
args: {
name: "duration",
},
},
{
name: ["-b", "--fqbn"],
description: "Fully Qualified Board Name, example: 'arduino:avr:uno'",
args: {
name: "FQBN",
description: "Fully qualified board name",
generators: FQBNs,
},
},
{
name: ["-h", "--help"],
description: "Help for debug",
},
{
name: ["-I", "--info"],
description:
"Show metadata about the debug session instead of starting the debugger",
},
{
name: "--input-dir",
description: "Directory containing binaries for debug",
args: {
name: "directory",
template: "folders",
},
},
{
name: "--interpreter",
description:
'Debug interpreter, example: console, mi, mi1, mi2, mi3 (default "console")',
args: {
suggestions: [
{
name: "console",
description: "Debug interpreter 'console'",
},
{
name: "mi",
description: "Debug interpreter 'mi'",
},
{
name: "mi1",
description: "Debug interpreter 'mi1'",
},
{
name: "mi2",
description: "Debug interpreter 'mi2'",
},
{