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

In-line splatting #17706

Closed
saladproblems opened this issue Jul 18, 2022 · 2 comments
Closed

In-line splatting #17706

saladproblems opened this issue Jul 18, 2022 · 2 comments
Labels
Issue-Enhancement the issue is more of a feature request than a bug

Comments

@saladproblems
Copy link

Summary of the new feature / enhancement

Currently you must define a variable to splat parameters to a command. Allow splatting a hashtable directly.

This could simplify syntax and reduce mistakes from splatting in loops where the current loop fails to update the splatted variable and the wrong iteration's parameters are applied.

Additionally, it may to provide parameter tab completion for an in-line splat than a variable defined before the function is called.

Proposed technical implementation details (optional)

Invoke-Command @{
    ComputerName = 'computer1','computer2','computer3'
    ScriptBlock = { 'my name is {0}' -f $env:computername }
    ErrorAction = 'stop'
}

@saladproblems saladproblems added Issue-Enhancement the issue is more of a feature request than a bug Needs-Triage The issue is new and needs to be triaged by a work group. labels Jul 18, 2022
@iRon7
Copy link

iRon7 commented Jul 19, 2022

I think this is a duplicate with: #10073

@saladproblems
Copy link
Author

You're absolutely right. I searched for splatting and hashtables, but didn't see it at the time.

@ghost ghost removed the Needs-Triage The issue is new and needs to be triaged by a work group. label Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement the issue is more of a feature request than a bug
Projects
None yet
Development

No branches or pull requests

2 participants