-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add implied to typedef and precedence #1790
Conversation
I had wondered about making priorities more explicit in earlier PR, but it got too complicated for what at the time was just adding one more usage! Did some direct tests instead. See if we make it work this time... I am finding it hard to reason about what |
I was having a look at the code being touched, and will have to refresh myself on the goals. Some of the processing relies on the order of the various methods and does not respect a "priority" as such. I went to some care so a parsing function would only be called once if both environment variable and CLI defined, so more than just which is higher priority. The current code is effectively only over-writing known sources in a couple of places. Treating it as priorities might be overpromising. |
IMO undefined is means no value is set, 'unknown' is value is set with unknown source.
This can be simplified by removing the second parameter and changing the comparison a bit.
Yes, that isn't a pattern right now.
|
Have you got a compelling use case for I have experimenting with it myself in past, so know it is tempting! But not sneaking in new features when the initial goal is just adding On a somewhat related note, I had wanted to make author supplied value possible, and have opened a PR with some typing to achieve that over here: commander-js/extra-typings#3 |
Actually the goal of this PR is to priorities make sense.
Since 'config' source is 'built-in' I would love to use something like this with having to worry about priorities:
A custom option source is not useful and will complicate even more the situation. It should be implemented after the above point are resolved. I really don't know if there is anything in this PR you think it's useful other than the 'implied' at source definition. |
Ok, thanks, that makes the intent of this PR make more sense. I was struggling with this PR based on its problem definition. I didn't pick up from the other issues that you are trying to implement a
My experience in the development of For configuration files specified using options this is extra complicated! Not just how to manage the priorities, but how to trigger the option reading at all. For configuration from a fixed source (like say GITHUB environment variables) I think this should be easier. You mentioned 'parseConfig' in a couple of issues. Maybe open an issue about what you are trying to do currently and what the problem is. Two implementation decisions are:
|
Glad you aren't blocked! Don't open a (I'm going to do a couple of changes from issues raised in this PR.) |
Pull Request
Problem
I was trying to understand source. I had difficulties, so did some changes to try to make easier to understand.
Following #1788 (comment).
setOptionValue()
, instead of not changing the source.Solution
ChangeLog