lsegal / yard

YARD is a Ruby Documentation tool. The Y stands for "Yay!"
http://yardoc.org
MIT License
1.95k stars 398 forks source link

`yard server` ignores `--query` #1527

Closed krystof-k closed 2 months ago

krystof-k commented 10 months ago

yard server ignores --query parameter and renders everything.

Steps to reproduce

This is the minimal reproduction for the issue. I've done my best to remove all extraneous code and unique environment state on my machine before providing these steps:

  1. Run the following command: yard server --reload --query 'has_tag?(:todo)'
  2. Open browser at http://localhost:8808
  3. You see everything
  4. Run the following command: yard doc --query 'has_tag?(:todo)'
  5. Open browser at the doc/index.html
  6. You see only items tagged as @todo

Actual Output

yard server ignores the query, yard doc respects it.

Expected Output

Both yard server and yard doc behave the same and respects the query.

Environment details:

I have read the Contributing Guide.

lsegal commented 2 months ago

You should be seeing the following, since yard server does not support --query:

[warn]: Unrecognized/invalid option: --query

This is intended behavior since yard server does not directly run yard doc. In order to filter, you would need --query in the specific project's .yardopts file. In the case of serving a single directory, "specific project" means your current project.

Closing this since it works as intended, you should specify arguments to yard doc in your .yardopts, and yard server is not meant to be a superset of yard doc.

krystof-k commented 2 months ago

Thanks @lsegal, you're right, I see, I just didn't look, sorry about that:

[warn]: Unrecognized/invalid option: --query
[warn]: Unrecognized/invalid option: --hide-tag

Anyway I find it a little confusing, I'd expect all the options of yard doc to work as well, it would be nice to add support for it.

.yardopts doesn't quite work, because I want to run two servers, one with everything and one with just a specific tag, maybe it is somehow possible to use different files for each server, I'll try to look that up.