Support splatting `-ArgumentList` with hashtable too
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 42/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- powershell
- Domaine
- backend
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- PowerShell
- Étoiles
- 37
- Forks
- 22
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de PowerShell/ThreadJob
-
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
PowerShell/ThreadJob#59 · 1 réaction ·
-
enhancement
Difficulté 3/5 1-2 jours Accessibilité débutants 56/100
PowerShell/ThreadJob#56 · 1 réaction ·
-
Set alias for ThreadJob command(s)Peut-être pris @kilasuit l’a pris il y a 82 jours. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 20/100
PowerShell/ThreadJob#45 · 1 commentaire ·
-
Difficulté 1/5 1-3 heures Accessibilité débutants 48/100
PowerShell/ThreadJob#44 ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
PowerShell/ThreadJob#43 ·
Toutes les issues de PowerShell/ThreadJob
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
containerd/containerd#14476 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
hackclub/hcb#15454 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
area: server priority: P3 type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
appandflow/stim#4538 ·
Les mainteneurs répondent en général sous 1 jour
-
[BUG] Published Docker images lack the redis extra: HEADROOM_COMPRESS_SESSION_STORE stops startupPeut-être pris @AlessandroSpallina l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
headroomlabs-ai/headroom#4513 ·
Les mainteneurs répondent en général sous 1 jour
-
kind/bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
ome-projects/ome#1242 ·
Les mainteneurs répondent en général sous 1 jour