Title: Support splatting `-ArgumentList` with hashtable too · Issue #37 · PowerShell/ThreadJob · GitHub
Open Graph Title: Support splatting `-ArgumentList` with hashtable too · Issue #37 · PowerShell/ThreadJob
X Title: Support splatting `-ArgumentList` with hashtable too · Issue #37 · PowerShell/ThreadJob
Description: Summary of the new feature / enhancement Start-ThreadJob (and Start-Job for reference) currently only supports splatting -ArgumentList with array: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_...
Open Graph Description: Summary of the new feature / enhancement Start-ThreadJob (and Start-Job for reference) currently only supports splatting -ArgumentList with array: https://learn.microsoft.com/en-us/powershell/modul...
X Description: Summary of the new feature / enhancement Start-ThreadJob (and Start-Job for reference) currently only supports splatting -ArgumentList with array: https://learn.microsoft.com/en-us/powershell/modul...
Opengraph URL: https://github.com/PowerShell/ThreadJob/issues/37
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support splatting `-ArgumentList` with hashtable too","articleBody":"### Summary of the new feature / enhancement\r\n\r\n`Start-ThreadJob` (and `Start-Job` for reference) currently only supports splatting `-ArgumentList` with array:\r\n\r\n* \u003chttps://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_splatting?view=powershell-7.4#splatting-with-arrays>\r\n\r\nThis means some example code must be like this:\r\n\r\n```powershell\r\n$JobsUsingArray = [array](\r\n 1 .. 3 | ForEach-Object -Process {\r\n Start-ThreadJob -ScriptBlock {\r\n [OutputType([System.String])]\r\n Param(\r\n [Parameter(Mandatory,Position=0)][string]$SomeParameter\r\n )\r\n Write-Output -InputObject $SomeParameter\r\n } -ArgumentList ('Hello {0}' -f $_)\r\n }\r\n)\r\nReceive-Job -Job $JobsUsingArray -Wait\r\n```\r\n\r\nwhich returns:\r\n\r\n```\r\nHello 1\r\nHello 2\r\nHello 3\r\n```\r\n\r\nI much prefer to splat using name of the input parameters, so splatting with hashtable. I'd like this to work too:\r\n\r\n```powershell\r\n$JobsUsingHashtable = [array](\r\n 1 .. 3 | ForEach-Object -Process {\r\n Start-ThreadJob -ScriptBlock {\r\n [OutputType([System.String])]\r\n Param(\r\n [Parameter(Mandatory)][string]$SomeParameter\r\n )\r\n Write-Output -InputObject $SomeParameter\r\n } -ArgumentList @{\r\n 'SomeParameter' = [string] 'Hello {0}' -f $_\r\n }\r\n }\r\n)\r\nReceive-Job -Job $JobsUsingHashtable -Wait\r\n```\r\n\r\nwhich returns\r\n\r\n```\r\nSystem.Collections.Hashtable\r\nSystem.Collections.Hashtable\r\nSystem.Collections.Hashtable\r\n```\r\n\r\n### Proposed technical implementation details (optional)\r\n\r\n_No response_","author":{"url":"https://github.com/o-l-a-v","@type":"Person","name":"o-l-a-v"},"datePublished":"2024-05-27T11:33:33Z","url":"https://github.com/PowerShell/ThreadJob/issues/37"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:84a18362-e53e-65d8-4574-402f62e15717 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8518:28C95D:114B386:188B718:6AFCD59A |
| html-safe-nonce | dba717c34c550d42d840642d2f7234fbc0339bdd1f9a6675b448d0fbae57c18c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTE4OjI4Qzk1RDoxMTRCMzg2OjE4OEI3MTg6NkFGQ0Q1OUEiLCJ2aXNpdG9yX2lkIjoiMzUxNjgwNjI3NDE1NjkwOTk3OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 63e248cf79e425a2b15a9c70841a8127280af0aff9381d752dafb7e220ec2b90 |
| hovercard-subject-tag | issue:2318938580 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/ThreadJob/37/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7a1e63f59592977b23b511caf5987d79c965c2aa6a9019c75c20d07f85895ab8/PowerShell/ThreadJob/issues/37 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7a1e63f59592977b23b511caf5987d79c965c2aa6a9019c75c20d07f85895ab8/PowerShell/ThreadJob/issues/37 |
| og:image:alt | Summary of the new feature / enhancement Start-ThreadJob (and Start-Job for reference) currently only supports splatting -ArgumentList with array: https://learn.microsoft.com/en-us/powershell/modul... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | o-l-a-v |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5b7bc7e41e0a604bbdb5035c7ed9620c2d28b9c8a18747182e2262a75abfd91 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/ThreadJob git https://github.com/PowerShell/ThreadJob.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 265675369 |
| octolytics-dimension-repository_nwo | PowerShell/ThreadJob |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 265675369 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/ThreadJob |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ff5022cc3aa767e6115451d9c322dd975506d40e |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width