Crescendo
Crescendo copied to clipboard
Conversion of input parameter values
The binary I'm working with takes a comma-delimited list of strings. I would like to take in a string[] and simply -join '' at runtime.
Args list should look like this
list
items
--categories
passwords,logins
Currently looks like this.
list
items
--categories
passwords
logins
Definition
{
"Name": "Categories",
"OriginalName": "--categories",
"ParameterType": "string[]",
"Description": "Only list items in these categories",
"Position": 0
},
+1 on this, parameter transformation is also very commonly needed for all types of array parameters. Sometimes you need to pass each value as with the same repeated parameter, sometimes it's encoded as a single value joined by a character like ',', etc.
One example is the Docker CLI that takes environment variables as a series of "-e NAME="VAL"" parameters. Here's how I do it: https://github.com/Devolutions/WaykBastion-ps/blob/master/WaykBastion/Private/DockerHelper.ps1#L367
+1 too. I would like to transform a PSCredential so I can map it to --username and --password. Cause we all know that is not secure. Related to #34
Glob Pattern strings need to be single quoted before passing to native cmd
I am working on GitHub CLI and need to have an input parameter single quoted since it is a glob pattern. Without the single quotes, at runtime it executes the glob matching before the native command gets control. As an experiment, I tried specifying the string like "'*pkg'" to the PowerShell parameter - but the native cmd could not find a match. I was able to test the native cmd successfully using --pattern '*pkg'
# download only Debian packages for the latest release
$ gh release download --pattern '*.deb'
Copy-GHReleaseAsset -Tag 'v7.1.1' -Pattern "'*pkg'" -Repo 'PowerShell/PowerShell' -Verbose
VERBOSE: gh
VERBOSE: release
VERBOSE: download
VERBOSE: v7.1.1
VERBOSE: --pattern
VERBOSE: '*pkg'
VERBOSE: --repo
VERBOSE: PowerShell/PowerShell
VERBOSE: Performing the operation "Copy-GHReleaseAsset" on target "gh".
no assets match the file pattern
@cdhunt -- We agree that this would be a good addition. For a workaround today, see https://github.com/PowerShell/Crescendo/issues/31#issuecomment-770240370
Thank you! Fixed/closed - in release: https://www.powershellgallery.com/packages/Microsoft.PowerShell.Crescendo/1.1.0-RC1