docs
docs copied to clipboard
Update the ParseParameters pattern documentation to allow "=" in addition to colon (:) for property value pairs
https://github.com/chocolatey/choco/wiki/How-To-Parse-PackageParameters-Argument uses colons for its sample. It should allow equals as well.
@DarwinJS mentions this makes things look inconsistent for how you pass arguments as compared to install arguments, which are typically passed with "=" in between property value pairs.
I found something else related to this that is worth making part of this ticket. The captured value has the quotes, and in the case of a path, that makes it invalid path, and is causing warnings. Here is the update expression that doesn't include the quotes, and allows "=" and "-" as the option/value separator.
$match_pattern = "\/(?<option>([a-zA-Z0-9]+))(:|=|-)([`"'])?(?<value>([a-zA-Z0-9- _\\:\.\!\@\#\$\%\^\&\*\(\)+]+))([`"'])?|\/(?<option>([a-zA-Z0-9]+))"
Updated Regex to support numbers in the parameters, and special characters in the value.
I also found that you cannot have numbers in parameter names.
Thanks folks!
We'll need to update the example, but in 0.10.8, Get-PackageParameters
is now part of Chocolatey itself and supports the =
- https://github.com/chocolatey/choco/issues/1393
We need to check if this still needs to be updated, but this will be completed in the docs repository, so moving it there.