Added ability to specify 'availableOptions' as a function in command #4966
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.
This is related to #4891/#4958 which prevents ember-cli-release from being updated.
The addon has a default set of options that is augmented with options specified in a configuration file. This is important so that the user can tailor the behavior of running
ember release
to individual repositories without having to remember what options to specify (which are often not the defaults). This presents a challenge because there's no initialization hook in commands in which to read the config file and override options. This PR provides the ability to specify theavailableOptions
property as a function that is invoked a single time in the constructor.The upside to this approach is its simplicity and straightforwardness for most cases. The downside is that overwriting the
availableOptions
property with the results of the function invocation is weird, and might catch someone off guard who expects to be able to invoke the function internally later.Alternatives:
buildAvailableOptions
hook that is a no-op by default and is called in the same place in the constructor.init
hook that is called from the constructor to perform initialization tasks.cc @rwjblue