Skip to content

Commit e883b64

Browse files
committed
Updated all --format json references to use --json
1 parent c0dfacc commit e883b64

19 files changed

+244
-244
lines changed

Diff for: docs/getting-started.md

+19-18
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,35 @@ IDE. Let's see some examples.
88

99
```console
1010
$ arduino-cli help core
11-
Arduino Core operations.
11+
Arduino core operations.
1212

1313
Usage:
14-
arduino-cli core [command]
14+
arduino-cli core [command]
1515

1616
Examples:
17-
./arduino-cli core update-index
17+
arduino-cli core update-index
1818

1919
Available Commands:
20-
download Downloads one or more cores and corresponding tool dependencies.
21-
install Installs one or more cores and corresponding tool dependencies.
22-
list Shows the list of installed platforms.
23-
search Search for a core in Boards Manager.
24-
uninstall Uninstalls one or more cores and corresponding tool dependencies if no more used.
25-
update-index Updates the index of cores.
26-
upgrade Upgrades one or all installed platforms to the latest version.
20+
download Downloads one or more cores and corresponding tool dependencies.
21+
install Installs one or more cores and corresponding tool dependencies.
22+
list Shows the list of installed platforms.
23+
search Search for a core in Boards Manager.
24+
uninstall Uninstalls one or more cores and corresponding tool dependencies if no longer used.
25+
update-index Updates the index of cores.
26+
upgrade Upgrades one or all installed platforms to the latest version.
2727

2828
Flags:
29-
-h, --help help for core
29+
-h, --help help for core
3030

3131
Global Flags:
32-
--additional-urls strings Additional URLs for Boards Manager.
33-
--config-file string The custom config file (if not specified the default will be used).
34-
--format string The output format, can be [text|json]. (default "text")
35-
--log-file string Path to the file where logs will be written.
36-
--log-format string The output format for the logs, can be [text|json].
37-
--log-level string Messages with this level and above will be logged.
38-
-v, --verbose Print the logs on the standard output.
32+
--additional-urls strings Comma-separated list of additional URLs for the Boards Manager.
33+
--config-file string The custom config file (if not specified the default will be used).
34+
--json Print the output in JSON format.
35+
--log Print the logs on the standard output.
36+
--log-file string Path to the file where logs will be written.
37+
--log-format string The output format for the logs, can be: text, json
38+
--log-level string Messages with this level and above will be logged. Valid levels are: trace, debug, info, warn, error, fatal, panic
39+
--no-color Disable colored output.
3940

4041
Use "arduino-cli core [command] --help" for more information about a command.
4142
```

Diff for: docs/versioning.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ The following changes to the command-line syntax are NOT considered breaking:
4545
Any change in the **human-readable** text output is **NOT** considered a breaking change. In general, the human-readable
4646
text is subject to translation and small adjustments in natural language syntax and presentation.
4747

48-
We will consider breaking changes only in the **machine-readable** output of the commands using the `--format json`
49-
flag. In particular, we have a breaking change in the JSON command output if:
48+
We will consider breaking changes only in the **machine-readable** output of the commands using the `--json` flag. In
49+
particular, we have a breaking change in the JSON command output if:
5050

5151
- a key in a JSON object is renamed or removed.
5252
- a value in a JSON object or array changes meaning or changes format.

Diff for: internal/cli/core/upgrade.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func Upgrade(inst *rpc.Instance, args []string, skipPostInstall bool, skipPreUni
142142
feedback.PrintResult(&platformUpgradeResult{})
143143
}
144144

145-
// This is needed so we can print warning messages in case users use --format json
145+
// This is needed so we can print warning messages in case users use --json
146146
type platformUpgradeResult struct{}
147147

148148
// Data implements feedback.Result.

Diff for: internal/integrationtest/arduino-cli.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ func (cli *ArduinoCLI) run(stdoutBuff, stderrBuff io.Writer, stdinBuff io.Reader
375375

376376
// StartDaemon starts the Arduino CLI daemon. It returns the address of the daemon.
377377
func (cli *ArduinoCLI) StartDaemon(verbose bool) string {
378-
args := []string{"daemon", "--format", "json"}
378+
args := []string{"daemon", "--json"}
379379
if cli.cliConfigPath != nil {
380380
args = append([]string{"--config-file", cli.cliConfigPath.String()}, args...)
381381
}

Diff for: internal/integrationtest/board/board_test.go

+20-20
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestCorrectBoardListOrdering(t *testing.T) {
3636
require.NoError(t, err)
3737
_, _, err = cli.Run("core", "install", "arduino:avr")
3838
require.NoError(t, err)
39-
jsonOut, _, err := cli.Run("board", "listall", "--format", "json")
39+
jsonOut, _, err := cli.Run("board", "listall", "--json")
4040
require.NoError(t, err)
4141
requirejson.Query(t, jsonOut, "[.boards[] | .fqbn]", `[
4242
"arduino:avr:yun",
@@ -80,7 +80,7 @@ func TestBoardList(t *testing.T) {
8080

8181
cli.InstallMockedSerialDiscovery(t)
8282

83-
stdout, _, err := cli.Run("board", "list", "--format", "json")
83+
stdout, _, err := cli.Run("board", "list", "--json")
8484
require.NoError(t, err)
8585
// check is a valid json and contains a list of ports
8686
requirejson.Parse(t, stdout).
@@ -97,7 +97,7 @@ func TestBoardListMock(t *testing.T) {
9797

9898
cli.InstallMockedSerialDiscovery(t)
9999

100-
stdout, _, err := cli.Run("board", "list", "--format", "json")
100+
stdout, _, err := cli.Run("board", "list", "--json")
101101
require.NoError(t, err)
102102

103103
// check is a valid json and contains a list of ports
@@ -136,7 +136,7 @@ func TestBoardListWithFqbnFilter(t *testing.T) {
136136

137137
cli.InstallMockedSerialDiscovery(t)
138138

139-
stdout, _, err := cli.Run("board", "list", "-b", "foo:bar:baz", "--format", "json")
139+
stdout, _, err := cli.Run("board", "list", "-b", "foo:bar:baz", "--json")
140140
require.NoError(t, err)
141141
requirejson.Query(t, stdout, `.detected_ports | length`, `0`)
142142
}
@@ -150,7 +150,7 @@ func TestBoardListWithFqbnFilterInvalid(t *testing.T) {
150150

151151
cli.InstallMockedSerialDiscovery(t)
152152

153-
_, stderr, err := cli.Run("board", "list", "-b", "yadayada", "--format", "json")
153+
_, stderr, err := cli.Run("board", "list", "-b", "yadayada", "--json")
154154
require.Error(t, err)
155155
requirejson.Query(t, stderr, ".error", `"Invalid FQBN: not an FQBN: yadayada"`)
156156
}
@@ -164,7 +164,7 @@ func TestBoardListall(t *testing.T) {
164164
_, _, err = cli.Run("core", "install", "arduino:[email protected]")
165165
require.NoError(t, err)
166166

167-
stdout, _, err := cli.Run("board", "listall", "--format", "json")
167+
stdout, _, err := cli.Run("board", "listall", "--json")
168168
require.NoError(t, err)
169169

170170
requirejson.Query(t, stdout, ".boards | length", "26")
@@ -224,7 +224,7 @@ func TestBoardListallWithManuallyInstalledPlatform(t *testing.T) {
224224
})
225225
require.NoError(t, err)
226226

227-
stdout, _, err := cli.Run("board", "listall", "--format", "json")
227+
stdout, _, err := cli.Run("board", "listall", "--json")
228228
require.NoError(t, err)
229229

230230
requirejson.Query(t, stdout, ".boards | length", "17")
@@ -274,11 +274,11 @@ func TestBoardDetails(t *testing.T) {
274274
require.NoError(t, err)
275275

276276
// Test board listall with and without showing hidden elements
277-
stdout, _, err := cli.Run("board", "listall", "MIPS", "--format", "json")
277+
stdout, _, err := cli.Run("board", "listall", "MIPS", "--json")
278278
require.NoError(t, err)
279279
require.Equal(t, string(stdout), "{}\n")
280280

281-
stdout, _, err = cli.Run("board", "listall", "MIPS", "-a", "--format", "json")
281+
stdout, _, err = cli.Run("board", "listall", "MIPS", "-a", "--json")
282282
require.NoError(t, err)
283283
requirejson.Contains(t, stdout, `{
284284
"boards": [
@@ -288,7 +288,7 @@ func TestBoardDetails(t *testing.T) {
288288
]
289289
}`)
290290

291-
stdout, _, err = cli.Run("board", "details", "-b", "arduino:samd:nano_33_iot", "--format", "json")
291+
stdout, _, err = cli.Run("board", "details", "-b", "arduino:samd:nano_33_iot", "--json")
292292
require.NoError(t, err)
293293

294294
requirejson.Contains(t, stdout, `{
@@ -425,7 +425,7 @@ func TestBoardSearch(t *testing.T) {
425425
_, _, err := cli.Run("update")
426426
require.NoError(t, err)
427427

428-
stdout, _, err := cli.Run("board", "search", "--format", "json")
428+
stdout, _, err := cli.Run("board", "search", "--json")
429429
require.NoError(t, err)
430430
// Verifies boards are returned
431431
requirejson.NotEmpty(t, stdout)
@@ -441,7 +441,7 @@ func TestBoardSearch(t *testing.T) {
441441
]}`)
442442

443443
// Search in non installed boards
444-
stdout, _, err = cli.Run("board", "search", "--format", "json", "nano", "33")
444+
stdout, _, err = cli.Run("board", "search", "--json", "nano", "33")
445445
require.NoError(t, err)
446446
// Verifies boards are returned
447447
requirejson.NotEmpty(t, stdout)
@@ -457,7 +457,7 @@ func TestBoardSearch(t *testing.T) {
457457
_, _, err = cli.Run("core", "install", "arduino:[email protected]")
458458
require.NoError(t, err)
459459

460-
stdout, _, err = cli.Run("board", "search", "--format", "json")
460+
stdout, _, err = cli.Run("board", "search", "--json")
461461
require.NoError(t, err)
462462
requirejson.NotEmpty(t, stdout)
463463
// Verifies some FQBNs are now returned after installing a platform
@@ -474,7 +474,7 @@ func TestBoardSearch(t *testing.T) {
474474
}
475475
]}`)
476476

477-
stdout, _, err = cli.Run("board", "search", "--format", "json", "arduino", "yun")
477+
stdout, _, err = cli.Run("board", "search", "--json", "arduino", "yun")
478478
require.NoError(t, err)
479479
requirejson.NotEmpty(t, stdout)
480480
requirejson.Contains(t, stdout, `{
@@ -494,7 +494,7 @@ func TestBoardSearch(t *testing.T) {
494494
})
495495
require.NoError(t, err)
496496

497-
stdout, _, err = cli.Run("board", "search", "--format", "json")
497+
stdout, _, err = cli.Run("board", "search", "--json")
498498
require.NoError(t, err)
499499
requirejson.NotEmpty(t, stdout)
500500
// Verifies some FQBNs are now returned after installing a platform
@@ -531,7 +531,7 @@ func TestBoardSearch(t *testing.T) {
531531
}
532532
]}`)
533533

534-
stdout, _, err = cli.Run("board", "search", "--format", "json", "mkr1000")
534+
stdout, _, err = cli.Run("board", "search", "--json", "mkr1000")
535535
require.NoError(t, err)
536536
requirejson.NotEmpty(t, stdout)
537537
// Verifies some FQBNs are now returned after installing a platform
@@ -557,7 +557,7 @@ func TestBoardAttach(t *testing.T) {
557557
require.NoError(t, err)
558558

559559
{
560-
stdout, _, err := cli.Run("board", "attach", "-b", "arduino:avr:uno", sketchPath.String(), "--format", "json")
560+
stdout, _, err := cli.Run("board", "attach", "-b", "arduino:avr:uno", sketchPath.String(), "--json")
561561
require.NoError(t, err)
562562
requirejson.Query(t, stdout, ".fqbn", `"arduino:avr:uno"`)
563563

@@ -568,7 +568,7 @@ func TestBoardAttach(t *testing.T) {
568568
require.NotContains(t, string(yamlData), "default_protocol:")
569569
}
570570
{
571-
stdout, _, err := cli.Run("board", "attach", "-p", "/dev/ttyACM0", "-l", "serial", sketchPath.String(), "--format", "json")
571+
stdout, _, err := cli.Run("board", "attach", "-p", "/dev/ttyACM0", "-l", "serial", sketchPath.String(), "--json")
572572
require.NoError(t, err)
573573
requirejson.Query(t, stdout, ".fqbn", `"arduino:avr:uno"`)
574574
requirejson.Query(t, stdout, ".port.address", `"/dev/ttyACM0"`)
@@ -581,7 +581,7 @@ func TestBoardAttach(t *testing.T) {
581581
require.Contains(t, string(yamlData), "default_protocol: serial")
582582
}
583583
{
584-
stdout, _, err := cli.Run("board", "attach", "-p", "/dev/ttyACM0", sketchPath.String(), "--format", "json")
584+
stdout, _, err := cli.Run("board", "attach", "-p", "/dev/ttyACM0", sketchPath.String(), "--json")
585585
require.NoError(t, err)
586586
requirejson.Query(t, stdout, ".fqbn", `"arduino:avr:uno"`)
587587
requirejson.Query(t, stdout, ".port.address", `"/dev/ttyACM0"`)
@@ -594,7 +594,7 @@ func TestBoardAttach(t *testing.T) {
594594
require.NotContains(t, string(yamlData), "default_protocol:")
595595
}
596596
{
597-
stdout, _, err := cli.Run("board", "attach", "-b", "arduino:samd:mkr1000", "-P", "atmel_ice", sketchPath.String(), "--format", "json")
597+
stdout, _, err := cli.Run("board", "attach", "-b", "arduino:samd:mkr1000", "-P", "atmel_ice", sketchPath.String(), "--json")
598598
require.NoError(t, err)
599599
requirejson.Query(t, stdout, ".fqbn", `"arduino:samd:mkr1000"`)
600600
requirejson.Query(t, stdout, ".programmer", `"atmel_ice"`)

Diff for: internal/integrationtest/board/hardware_loading_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestHardwareLoading(t *testing.T) {
4343

4444
t.Run("Simple", func(t *testing.T) {
4545
{
46-
out, _, err := cli.Run("core", "list", "--format", "json")
46+
out, _, err := cli.Run("core", "list", "--json")
4747
require.NoError(t, err)
4848
jsonOut := requirejson.Parse(t, out)
4949
jsonOut.LengthMustEqualTo(1)
@@ -73,7 +73,7 @@ func TestHardwareLoading(t *testing.T) {
7373

7474
{
7575
// Also test local platform.txt properties override
76-
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:uno", "--format", "json")
76+
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:uno", "--json")
7777
require.NoError(t, err)
7878
jsonOut := requirejson.Parse(t, out)
7979
jsonOut.MustContain(`{
@@ -100,7 +100,7 @@ func TestHardwareLoading(t *testing.T) {
100100
}
101101

102102
{
103-
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:yun", "--format", "json")
103+
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:yun", "--json")
104104
require.NoError(t, err)
105105
jsonOut := requirejson.Parse(t, out)
106106
jsonOut.MustContain(`{
@@ -115,7 +115,7 @@ func TestHardwareLoading(t *testing.T) {
115115

116116
{
117117
// Check un-expansion of board_properties
118-
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:robotMotor", "--show-properties=unexpanded", "--format", "json")
118+
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:robotMotor", "--show-properties=unexpanded", "--json")
119119
require.NoError(t, err)
120120
jsonOut := requirejson.Parse(t, out)
121121
jsonOut.MustContain(`{
@@ -131,7 +131,7 @@ func TestHardwareLoading(t *testing.T) {
131131

132132
{
133133
// Also test local boards.txt properties override
134-
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:diecimila", "--show-properties=unexpanded", "--format", "json")
134+
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:diecimila", "--show-properties=unexpanded", "--json")
135135
require.NoError(t, err)
136136
jsonOut := requirejson.Parse(t, out)
137137
jsonOut.MustContain(`{
@@ -152,7 +152,7 @@ func TestHardwareLoading(t *testing.T) {
152152
require.NoError(t, customHwDir.CopyDirTo(cli.SketchbookDir().Join("hardware")))
153153

154154
{
155-
out, _, err := cli.Run("core", "list", "--format", "json")
155+
out, _, err := cli.Run("core", "list", "--json")
156156
require.NoError(t, err)
157157
jsonOut := requirejson.Parse(t, out)
158158
jsonOut.Query(`.platforms | length`).LengthMustEqualTo(3)
@@ -217,7 +217,7 @@ func TestHardwareLoading(t *testing.T) {
217217

218218
{
219219
// Also test local platform.txt properties override
220-
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:uno", "--format", "json")
220+
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:uno", "--json")
221221
require.NoError(t, err)
222222
jsonOut := requirejson.Parse(t, out)
223223
jsonOut.MustContain(`{
@@ -244,7 +244,7 @@ func TestHardwareLoading(t *testing.T) {
244244
}
245245

246246
{
247-
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:yun", "--show-properties=unexpanded", "--format", "json")
247+
out, _, err := cli.Run("board", "details", "-b", "arduino:avr:yun", "--show-properties=unexpanded", "--json")
248248
require.NoError(t, err)
249249
jsonOut := requirejson.Parse(t, out)
250250
jsonOut.MustContain(`{

Diff for: internal/integrationtest/compile_1/compile_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func compileWithSimpleSketchCustomEnv(t *testing.T, env *integrationtest.Environ
164164
require.NoError(t, err)
165165

166166
// Build sketch for arduino:avr:uno with json output
167-
stdout, _, err = cli.RunWithCustomEnv(customEnv, "compile", "-b", fqbn, sketchPath.String(), "--format", "json")
167+
stdout, _, err = cli.RunWithCustomEnv(customEnv, "compile", "-b", fqbn, sketchPath.String(), "--json")
168168
require.NoError(t, err)
169169
// check is a valid json and contains requested data
170170
var compileOutput map[string]interface{}
@@ -516,7 +516,7 @@ func compileWithExportBinariesConfig(t *testing.T, env *integrationtest.Environm
516516
defer cli.WorkingDir().Join("arduino-cli.yaml").Remove()
517517

518518
// Test if arduino-cli config file written in the previous run has the `always_export_binaries` flag set.
519-
stdout, _, err := cli.Run("config", "dump", "--format", "json", "--config-file", "arduino-cli.yaml")
519+
stdout, _, err := cli.Run("config", "dump", "--json", "--config-file", "arduino-cli.yaml")
520520
require.NoError(t, err)
521521
requirejson.Contains(t, stdout, `
522522
{
@@ -845,7 +845,7 @@ func TestCompileWithArchivesAndLongPaths(t *testing.T) {
845845
_, _, err = cli.Run("lib", "install", "ArduinoIoTCloud", "--config-file", "arduino-cli.yaml")
846846
require.NoError(t, err)
847847

848-
stdout, _, err := cli.Run("lib", "examples", "ArduinoIoTCloud", "--format", "json", "--config-file", "arduino-cli.yaml")
848+
stdout, _, err := cli.Run("lib", "examples", "ArduinoIoTCloud", "--json", "--config-file", "arduino-cli.yaml")
849849
require.NoError(t, err)
850850
libOutput := strings.Trim(requirejson.Parse(t, stdout).Query(`.examples.[0].library.install_dir`).String(), `"`)
851851
sketchPath := paths.New(libOutput)
@@ -1189,7 +1189,7 @@ void loop() {
11891189
`
11901190
expected = strings.ReplaceAll(expected, "%SKETCH_PATH%", cpp.QuoteString(sketchPath.Join("SketchSimple.ino").String()))
11911191

1192-
jsonOut, _, err := cli.Run("compile", "-b", fqbn, "--preprocess", sketchPath.String(), "--format", "json")
1192+
jsonOut, _, err := cli.Run("compile", "-b", fqbn, "--preprocess", sketchPath.String(), "--json")
11931193
require.NoError(t, err)
11941194
var ex struct {
11951195
CompilerOut string `json:"compiler_out"`

Diff for: internal/integrationtest/compile_3/compile_commands_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestCompileCommandsJSONGeneration(t *testing.T) {
3636
require.NoError(t, err)
3737

3838
// Create a test sketch
39-
out, _, err := cli.Run("sketch", "new", "Test", "--format", "json")
39+
out, _, err := cli.Run("sketch", "new", "Test", "--json")
4040
require.NoError(t, err)
4141
var s struct {
4242
Path string `json:"sketch_path"`

0 commit comments

Comments
 (0)