-
Notifications
You must be signed in to change notification settings - Fork 247
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
Use the defined type to the default value of directory
#566
Conversation
@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? |
@ColinDKelley If my understanding is correct, this warning has started since Thor v1.0.0. PR: rails/thor#626 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.)
lib/listen/cli.rb
Outdated
@@ -18,7 +18,7 @@ class CLI < Thor | |||
|
|||
class_option :directory, | |||
type: :array, | |||
default: '.', | |||
default: ['.'], | |||
aliases: '-d', | |||
banner: 'The directory to listen to' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
banner: 'The directory to listen to' | |
banner: 'One or more directories to listen to' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
Currently, you will get Thor's deprecated message when starting the
Listen::CLI
.This is due to the incorrect default value(
directory
is defined as anarray
, but the default value is astring
).This fixed to use the correct default value and correctly pass to the
directory
toListen.to
.