-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Command.CommandText doesn't display parameters #12405
Comments
@TylerLeonhardt But, it would be nice if the |
Kinda complicated to do. For instance, what would it print here: var obj = new object();
ps.AddCommand('Save-Object').AddArgument(obj); |
Yeah that's tricky @SeeminglyScience. I would guess just calling ToString() on each parameter value / argument. |
What's the motivation if it can't accurately represent the command though? Just a visual aid? Some other issues:
Just to clarify I totally understand where you're coming from. I ran into the same thing and thought a while about how to get an accurate representation. I just want to make sure the aim isn't to get an equivalent invokable script, because there's too many scenarios where that will be super inconsistent. If the aim is instead to just get a "good enough" |
Yeah this is the idea. |
In the case perhaps we need to have more descriptive name instead of |
the CommandText property name is slightly misleading. It really should have been called "CommandName" (this is clear from the comment in the code). Rather than changing this property name, a new property could be created. However, this can also be done with an ETS extension external to the engine. |
Command.CommandText
doesn't display parameters... this leaves the extension in an awkward position because we pass aroundPSCommand
's everywhere and there doesn't seem to be a friendly way of printing those out short of iterating over all the parameters ourselves.I would have expected PowerShell to take care of this by default.
Steps to reproduce
Expected behavior
Actual behavior
Environment data
The text was updated successfully, but these errors were encountered: