Use the defined type to the default value of directory#566
Merged
Conversation
Collaborator
|
@y-yagi Can you clarify: when did this warning start? Was this always a bug but just not detected until a recent version of Thor? |
Contributor
Author
|
@ColinDKelley If my understanding is correct, this warning has started since Thor v1.0.0. PR: rails/thor#626 |
ColinDKelley
reviewed
Jan 6, 2023
Collaborator
ColinDKelley
left a comment
There was a problem hiding this comment.
Looks good. Just one suggestion on the banner. (I considered changing the option name too, to directories, but that would be an interface change, and the plural case is rare, so it doesn't seem worth it.)
| default: '.', | ||
| default: ['.'], | ||
| aliases: '-d', | ||
| banner: 'The directory to listen to' |
Collaborator
There was a problem hiding this comment.
Suggested change
| banner: 'The directory to listen to' | |
| banner: 'One or more directories to listen to' |
Contributor
Author
There was a problem hiding this comment.
Thanks for your review. I fixed.
e5e932d to
f813b49
Compare
Currently, you will get Thor's deprecated message when starting the `Listen::CLI`. ``` Deprecation warning: Expected array default value for '--directory'; got "." (string). This will be rejected in the future unless you explicitly pass the options `check_default_type: false` or call `allow_incompatible_default_type!` in your code You can silence deprecations warning by setting the environment variable THOR_SILENCE_DEPRECATION. ``` This is due to the incorrect default value(`directory` is defined as an `array`, but the default value is a `string`). This fixed to use the correct default value and correctly pass to the `directory` to `Listen.to`.
f813b49 to
62e379c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, you will get Thor's deprecated message when starting the
Listen::CLI.This is due to the incorrect default value(
directoryis defined as anarray, but the default value is astring).This fixed to use the correct default value and correctly pass to the
directorytoListen.to.