-
-
Notifications
You must be signed in to change notification settings - Fork 402
[breaking] Clean up and refactor --format json
and, in general, how Arduino CLI output is handled
#2003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--format json
works and general Arduino CLI output is handled--format json
and, in general, how Arduino CLI output is handled
7075255
to
6a6885b
Compare
This was
linked to
issues
Dec 16, 2022
per1234
requested changes
Dec 16, 2022
The first test run gives: === RUN TestNoDirectOutputToStdOut burnbootloader/burnbootloader.go:85:5: object `os.Stdout` should not be used in this package (use `feedback.*` instead) burnbootloader/burnbootloader.go:85:16: object `os.Stderr` should not be used in this package (use `feedback.*` instead) compile/compile.go:235:84: object `os.Stdout` should not be used in this package (use `feedback.*` instead) compile/compile.go:235:95: object `os.Stderr` should not be used in this package (use `feedback.*` instead) compile/compile.go:274:72: object `os.Stdout` should not be used in this package (use `feedback.*` instead) compile/compile.go:274:83: object `os.Stderr` should not be used in this package (use `feedback.*` instead) compile/compile.go:296:4: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:297:4: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:298:4: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:305:3: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:306:3: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:307:3: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:308:3: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:309:3: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:311:3: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:313:4: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:319:4: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:321:5: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:325:4: function `fmt.Println` should not be used in this package (use `feedback.*` instead) compile/compile.go:326:4: function `fmt.Print` should not be used in this package (use `feedback.*` instead) completion/completion.go:58:34: object `os.Stdout` should not be used in this package (use `feedback.*` instead) completion/completion.go:61:38: object `os.Stdout` should not be used in this package (use `feedback.*` instead) completion/completion.go:63:32: object `os.Stdout` should not be used in this package (use `feedback.*` instead) completion/completion.go:66:32: object `os.Stdout` should not be used in this package (use `feedback.*` instead) completion/completion.go:68:38: object `os.Stdout` should not be used in this package (use `feedback.*` instead) daemon/interceptors.go:29:19: object `os.Stdout` should not be used in this package (use `feedback.*` instead) debug/debug.go:106:82: object `os.Stdout` should not be used in this package (use `feedback.*` instead) monitor/term.go:38:9: object `os.Stdout` should not be used in this package (use `feedback.*` instead) output/rpc_progress.go:115:4: function `fmt.Print` should not be used in this package (use `feedback.*` instead) output/rpc_progress.go:117:5: function `fmt.Println` should not be used in this package (use `feedback.*` instead) output/rpc_progress.go:119:5: function `fmt.Println` should not be used in this package (use `feedback.*` instead) upload/upload.go:163:5: object `os.Stdout` should not be used in this package (use `feedback.*` instead) upload/upload.go:163:16: object `os.Stderr` should not be used in this package (use `feedback.*` instead) cli.go:215:4: function `fmt.Println` should not be used in this package (use `feedback.*` instead) --- FAIL: TestNoDirectOutputToStdOut (0.01s) FAIL exit status 1 FAIL github.com/arduino/arduino-cli/cli 0.019s
Also changed a condition in a more meaningful way.
We may think of bringing it back again in the future if the global instance will be removed in a major refactoring of the CLI.
This is the better place where it belongs, and slighlty simplifies the golang API.
- Final "\n" is automatically printed when entering non-passwords (no need to do a Println() - The final "\n" is included in the result of ReadBytes() so it will be removed.
--format json
and, in general, how Arduino CLI output is handled--format json
and, in general, how Arduino CLI output is handled
ee2d2c3
to
dc8c25d
Compare
dc8c25d
to
0c2dc76
Compare
per1234
requested changes
Jan 13, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPDATE: resolved
$ arduino-cli version
arduino-cli.exe Version: git-snapshot Commit: 0c2dc76b Date: 2023-01-13T15:38:07Z
$ mkdir /tmp/FooSketch
$ printf "#error\nvoid setup() {}\nvoid loop() {}" > /tmp/FooSketch/FooSketch.ino
$ arduino-cli compile --fqbn arduino:avr:uno /tmp/FooSketch
C:\Users\per\AppData\Local\Temp\FooSketch\FooSketch.ino:1:2: error: #error
#error
^~~~~
Used platform Version Path
arduino:avr 1.8.6 C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6
Error during build: exit status 1
Error during build: exit status 1
(note there are two "Error during build: exit status 1
" in the output)
0c2dc76
to
8cf4d6a
Compare
8cf4d6a
to
2988ecd
Compare
2988ecd
to
3d5ea52
Compare
per1234
approved these changes
Jan 14, 2023
umbynos
approved these changes
Jan 16, 2023
5 tasks
3 tasks
kittaakos
pushed a commit
to arduino/arduino-ide
that referenced
this pull request
Mar 10, 2023
`Can't write debug log: available only in text format` error is thrown by the CLI if the `--debug` flag is present. Ref: arduino/arduino-cli#2003 Closes #1942 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
6 tasks
kittaakos
pushed a commit
to arduino/arduino-ide
that referenced
this pull request
Mar 10, 2023
`Can't write debug log: available only in text format` error is thrown by the CLI if the `--debug` flag is present. Ref: arduino/arduino-cli#2003 Closes #1942 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos
pushed a commit
to arduino/arduino-ide
that referenced
this pull request
Mar 10, 2023
`Can't write debug log: available only in text format` error is thrown by the CLI if the `--debug` flag is present. Ref: arduino/arduino-cli#2003 Closes #1942 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
kittaakos
pushed a commit
to arduino/arduino-ide
that referenced
this pull request
Mar 13, 2023
`Can't write debug log: available only in text format` error is thrown by the CLI if the `--debug` flag is present. Ref: arduino/arduino-cli#2003 Closes #1942 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 task
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
topic: code
Related to content of the project itself
topic: infrastructure
Related to project infrastructure
type: enhancement
Proposed improvement
type: imperfection
Perceived defect in any part of project
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please check if the PR fulfills these requirements
See how to contribute
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)What kind of change does this PR introduce?
feedback
golang API has changed, this should fix all the issues where the JSON output is mixed with text.feedback
package is bypassed:feedback
API helped to clean up some commands behavior when--format json
is specified.What is the current / new behavior?
If the interactive terminal is required, JSON format will produce an error
CURRENT:
NEW:
JSON output produces an error if not compatible with the given command/args combination. Fatal errors are encoded in JSON
CURRENT:
NEW:
Warnings are printed in text mode, or accumulated in the json result in JSON mode
CURRENT:
NEW:
Does this PR introduce a breaking change, and is titled accordingly?
Yes.