Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Support splatting `-ArgumentList` with hashtable too

オープン
#37 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
powershell
領域
backend

調査の方向性

Start at the Start-ThreadJob argument handling and compare how -ArgumentList processes arrays with the hashtable example in this issue. The request is to pass named parameters through to the job script block; check the project’s existing tests for -ArgumentList and add coverage for the shown hashtable case. Done when the job receives SomeParameter as the string Hello 1, Hello 2, and Hello 3.

索引モデルが issue の本文から書いたものです。

説明

Summary of the new feature / enhancement

Start-ThreadJob (and Start-Job for reference) currently only supports splatting -ArgumentList with array:

This means some example code must be like this:

$JobsUsingArray  = [array](
    1 .. 3 | ForEach-Object -Process {
        Start-ThreadJob -ScriptBlock {
            [OutputType([System.String])]
            Param(
                [Parameter(Mandatory,Position=0)][string]$SomeParameter
            )
            Write-Output -InputObject $SomeParameter
        } -ArgumentList ('Hello {0}' -f $_)
    }
)
Receive-Job -Job $JobsUsingArray -Wait

which returns:

Hello 1
Hello 2
Hello 3

I much prefer to splat using name of the input parameters, so splatting with hashtable. I'd like this to work too:

$JobsUsingHashtable = [array](
    1 .. 3 | ForEach-Object -Process {
        Start-ThreadJob -ScriptBlock {
            [OutputType([System.String])]
            Param(
                [Parameter(Mandatory)][string]$SomeParameter
            )
            Write-Output -InputObject $SomeParameter
        } -ArgumentList @{
            'SomeParameter' = [string] 'Hello {0}' -f $_
        }
    }
)
Receive-Job -Job $JobsUsingHashtable -Wait

which returns

System.Collections.Hashtable
System.Collections.Hashtable
System.Collections.Hashtable
Proposed technical implementation details (optional)

No response

主要言語
PowerShell
スター
37
フォーク
22
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PowerShell/ThreadJob のほかの issue

PowerShell/ThreadJob の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。