Skip to content
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

Value passed to --no-api option is treated as the file glob to the yard command #685

Closed
trevorrowe opened this issue Jul 22, 2013 · 1 comment

Comments

@trevorrowe
Copy link
Contributor

When running the yard command, if the --no-api option is passed a value, then the default behavior of parsing the docs from lib/*/.rb no longer happens.

$ yard --no-api foo
Files:           0
Modules:         0 (    0 undocumented)
Classes:         0 (    0 undocumented)
Constants:       0 (    0 undocumented)
Methods:         0 (    0 undocumented)
 0.00% documented

Vs

$ yard --no-api
# ... code inside lib gets documented

It appears that the value passed is treated as the file glob.

$ yard --no-api foo
[debug]: Parsing ["foo"] with `ruby` parser
@lsegal
Copy link
Owner

lsegal commented Jul 27, 2013

Unfortunately this seems to be a limitation in optparse that I can't get around. If optparse sees a "--no-" prefix, it cannot parse an argument afterwards (the yielded value will always be false). Therefore, when you passed --no-api foo, the optparse library was assuming foo was not part of the switch.

Digging into this, I recall what --no-api was for: the switch is specifically meant to also include untagged objects from documentation. For example, if you use --api public to opt-in to an API, YARD will still ignore any objects that are not tagged with any @api tag. You might still want public API and anything that is unspecified, so adding --api public --no-api will list all @api public objects in addition to anything that was left untagged.

It seems like what you want is the ability to opt out of specific APIs from documentation rather than in. This is not what --no-api does, and since I can't support an argument on that switch, I've added a new --hide-api option that will do just that. If you do:

$ yard --hide-api private

It would be equivalent to:

$ yard --no-api --api public --api other --api apis --api except_private

Opting out rather than opting in might make much more sense in certain cases.

@lsegal lsegal closed this as completed in 3fc6a6b Jul 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants