Skip to content
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

Conversion of input parameter values #31

Closed
cdhunt opened this issue Dec 10, 2020 · 5 comments
Closed

Conversion of input parameter values #31

cdhunt opened this issue Dec 10, 2020 · 5 comments
Assignees
Labels
Issue-Enhancement New feature or request Issue-Triaged issue was read and triaged

Comments

@cdhunt
Copy link

cdhunt commented Dec 10, 2020

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
        },
@awakecoding
Copy link

+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

@webtroter
Copy link

+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

@theJasonHelmick theJasonHelmick added the Issue-Enhancement New feature or request label Jan 7, 2021
@theJasonHelmick theJasonHelmick added the Issue-Triaged issue was read and triaged label Jan 28, 2021
@JamesWTruher JamesWTruher self-assigned this Jan 28, 2021
@DonPwrShellHunt
Copy link

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

@theJasonHelmick
Copy link
Collaborator

@cdhunt -- We agree that this would be a good addition. For a workaround today, see #31 (comment)

@theJasonHelmick
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement New feature or request Issue-Triaged issue was read and triaged
Projects
None yet
Development

No branches or pull requests

6 participants