Skip to content

Why does this make a test fail? #624

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

Closed
wants to merge 1 commit into from

Conversation

marcandre
Copy link
Contributor

For some reason this outputs "Unknown switches '-w'" even though it is a class_option.

For some reason this outputs "Unknown switches '-w'" even though it is a class_option"
@Choms
Copy link
Contributor

Choms commented Sep 25, 2018

I think CompatibleWith19Plugin is missing a line with default_command :animal but to be honest I find this whole test spec quite confusing

@marcandre
Copy link
Contributor Author

I think CompatibleWith19Plugin is missing a line with default_command :animal but to be honest I find this whole test spec quite confusing

Looks like Thor::Group doesn't have that method, only Thor has.

In any case, I don't see how being strict about unknown options should have an impact about a class option like in this example.

If this is a bug, it should be fixed before we can consider deprecating the default...

@MaxLap
Copy link
Contributor

MaxLap commented Sep 26, 2018

When registering a Group. All that Thor does is define a command on the top-level. In this case, it will add BoringVendorProvidedCLI#zoo, which will call invoke on the CompatibleWith19Plugin.

This means that zoo is a command on the BoringVendorProvidedCLI. And because BoringVendorProvidedCLI is now check_unknown_options!, this is applied to the zoo command too.

Maybe adding an actual subcommand would make more sense, but I didn't look into the details of the current handling for subcommands.

This is part of the "invoke" system of Thor which I find hard to find use-case for. But that's just my opinion, and it's there so gotta deal with it.

@marcandre
Copy link
Contributor Author

Cleaning up my open PRs. Closing this as not much feedback

@marcandre marcandre closed this Jun 26, 2020
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

Successfully merging this pull request may close these issues.

3 participants