redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

Capability to export redoc lint report to file in command line

Open LasneF opened this issue 2 years ago • 6 comments

**Problem description **

As i am handling lots of issues in an api spec , i would like that the report is pushed on a file. On windows (at least) the command
redocly lint openapi.yaml --format=codeframe > lint_output.txt

does create only an empty file

Describe the solution you'd like

following redocly bundle command have an -o option where we can set the output report files

Additional context

OS : Windows Redocly version : 1.6.0

LasneF avatar Jan 02 '24 10:01 LasneF

Thanks for the idea, @LasneF! As a workaround, you can write stderr instead of stdout to a file (using 2> instead of >).

tatomyr avatar Jan 02 '24 10:01 tatomyr

notice here it would be cool to have capabilty to have the traces in the stdout as well as in a file

use case beeing , logs for debugs, file in CICD jenkins so that it is archived

LasneF avatar Feb 09 '24 13:02 LasneF

@LasneF have you considered running cat lint_output.txt after the lint command?

tatomyr avatar Feb 09 '24 14:02 tatomyr

@tatomyr you are a problem solver :) if it does not work workaround it :) will do that for now till a nice implementation

Thanks for the tips

LasneF avatar Feb 09 '24 14:02 LasneF

the problem is that some formats send the output to stdout and some to stderr 👎

marianobntz avatar Apr 24 '24 21:04 marianobntz

Our original terminal formats do send to standard out - originally we offered a combination command with lint and bundle, so the bundle output had to go to stdout and the lint information went to stderr. Some of the newer/dedicated formats such as JSON and Markdown do output to stdout. Changing the defaults has to wait until the next major version release (but is definitely firmly on my wishlist!)

The feature request to add a file output is good and this issue should stay open to get it done - we just hope that the workarounds can help you in the meantime!

lornajane avatar Jun 04 '24 09:06 lornajane