(#2500) List parameters in templates #2507
Merged
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.
Description Of Changes
This adds the ability for the template command to list the parameters
in templates. If the template is installed via a package, the
parameters get cached in a file called .parameters in the template's
directory. This file is ignored by calls to choco new, as it is
excluded from being copied.
There another method added to TokenReplacer to get the parameters via
regex. This keeps the regex in the TokenReplacer class.
Motivation and Context
It it useful to be able to list the available parameters in a template.
The parameters are cached to reduce the number of files that need to be read to get the parameters. Only templates installed via a
.template
package have the parameters cached. This is because those cache files would get deleted as a part of the package upgrade process, so any cache files from those templates would be up to date. However, for packages that are installed manually, there is not an efficient way to check that the cache is still valid, so that it why parameters from those templates are always read manually.Testing
Just like in #2385, unit tests cannot be added yet, due to #2501
Manual testing instructions:
msi.template
andzip.template
choco template --verbose
.parameters
fileChange Types Made
Related Issue
Fixes #2500
Depends on #2385 (now merged)
Change Checklist