dnaka91/llvm-cov-pretty

Add --output-dir option and document default location for output

Closed this issue · 3 comments

zackw commented

Is your feature request related to a problem? Please describe.

I had to dig into the source code to learn that llvm-cov-pretty writes its output to the directory target/llvm-cov-pretty (where target is the Cargo target directory for the project). There doesn't seem to be any way to override this location.

Describe the solution you'd like

  1. Please document the default output directory in the top-level README and the output of llvm-cov-pretty --help, and in the manual when there is one.
  2. Please add a command line option (I suggest --output-dir, matching cargo-llvm-cov) that changes the output directory. This option should also be documented in the top-level README and in llvm-cov-pretty --help.

Thank you for your time reporting the enhancement request.

If you're using a recent version, you should see a message at the end of the invocation of llvm-cov-pretty, that tells you where the report is located:

report generated at "target/llvm-cov-pretty/index.html"

This was added in v0.1.3 (88fb877) together with a new --open flag which automatically opens the report in your configured default application, usually the main browser.

Therefore, I'm not quite sure why you had to check the source code to find its location.


Putting it in the target/ folder is in my opinion kind of best practice. It keeps it in line with rustdoc, cargo-llvm-cov and other tools. That makes it easy, because you can simply expect most tools that output data to save it there.

But I agree that it might be useful from time to time to set a different output directory. Therefore, I'll introduce a new flag and document the default location together with it in the --help output.

zackw commented

I'm not quite sure why you had to check the source code to find [the report's] location.

I was writing a script to run in CI, so I needed to know the report's location before I had run llvm-cov-pretty even once. It was easier to dig through the source code than to install it on my local machine.

Putting it in the target/ folder is in my opinion kind of best practice

Yes, the default location is fine. It's just the lack of documentation and the lack of any way to change it that I would like to see improved.

I was writing a script to run in CI, so I needed to know the report's location before I had run llvm-cov-pretty even once. It was easier to dig through the source code than to install it on my local machine.

I see, that makes total sense 👍

Yes, the default location is fine. It's just the lack of documentation and the lack of any way to change it that I would like to see improved.

I published a new version which includes the --output-dir flag to change the output directory. In addition, the location is printed out at the end of invocation.

Therefore, I'll close this as complete.

For now, I won't add extra docs for each CLI flag to the README.md or to the repo directly, as it wouldn't be any more extensive than the --help output and brings the extra burden of keeping it in sync with that. Should not be asked too much to run the tool once to see the possible options.