guard / listen

The Listen gem listens to file modifications and notifies you about the changes.
https://rubygems.org/gems/listen
MIT License
1.93k stars 247 forks source link

Use the defined type to the default value of `directory` #566

Closed y-yagi closed 1 year ago

y-yagi commented 1 year ago

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.

ColinDKelley commented 1 year ago

@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?

y-yagi commented 1 year ago

@ColinDKelley If my understanding is correct, this warning has started since Thor v1.0.0. PR: https://github.com/rails/thor/pull/626 This isn't a bug and still works well now. But, as the deprecated message describes, it won't work in the future version. So we need to fix it.