Skip to content

Commit

Permalink
updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
santisq committed Jun 18, 2024
1 parent 82e804f commit 4b49371
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ This project was inspired by RamblingCookieMonster's [`Invoke-Parallel`](https:/

## What does this Module have to offer?

Except for [`-AsJob`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/foreach-object?view=powershell-7.4#-asjob), this module offers the same capabilities as `ForEach-Object -Parallel` in addition to supporting [Common Parameters](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters), missing feature in the _built-in_ cmdlet.
Except for [`-AsJob`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/foreach-object?view=powershell-7.4#-asjob), this module offers the same capabilities as `ForEach-Object -Parallel` in addition to supporting [Common Parameters](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters), a missing feature in the _built-in_ cmdlet.

### Truly pipeline streaming capabilities
### Pipeline streaming capabilities

```powershell
Measure-Command {
Expand All @@ -34,7 +34,7 @@ Measure-Command {

### Support for [CommonParameters](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7.4)

This is something missing on `ForEach-Object -Parallel` as of `v7.5.0.3`.
Something missing on `ForEach-Object -Parallel` as of `v7.5.0.3`.

```powershell
PS \> 0..5 | ForEach-Object -Parallel { Write-Error $_ } -ErrorAction Stop
Expand Down Expand Up @@ -91,7 +91,7 @@ PS \> 0..10 | Invoke-Parallel { $_; Start-Sleep 5 } -TimeoutSeconds 2
# Invoke-Parallel: Timeout has been reached.
```

### [`$using:`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_keywords?view=powershell-7.4) Support
## [`$using:`](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_language_keywords?view=powershell-7.4) Support

Same as `ForEach-Object -Parallel` you can use the `$using:` scope modifier to pass-in variables to the parallel invocations.

Expand All @@ -101,18 +101,18 @@ $message = 'world!'
# hello world!
```

### `-Functions` and `-Variables` Parameters
## `-Functions` and `-Variables` Parameters

Both parameters are a quality of life addition, specially `-Functions`, which adds the locally defined functions to the runspaces [Initial Session State](https://learn.microsoft.com/en-us/dotnet/api/system.management.automation.runspaces.initialsessionstate), a missing feature on `ForEach-Object -Parallel`. This is a much better alternative to passing-in the function definition to the parallel scope.

#### [`-Variables` Parameter](./docs/en-US/Invoke-Parallel.md#-variables)
### [`-Variables` Parameter](./docs/en-US/Invoke-Parallel.md#-variables)

```powershell
'hello ' | Invoke-Parallel { $_ + $msg } -Variables @{ msg = 'world!' }
# hello world!
```

#### [`-Functions` Parameter](./docs/en-US/Invoke-Parallel.md#-functions)
### [`-Functions` Parameter](./docs/en-US/Invoke-Parallel.md#-functions)

```powershell
function Get-Message {param($MyParam) $MyParam + 'world!' }
Expand Down Expand Up @@ -144,7 +144,7 @@ Set-Location ./PSParallelPipeline

## Requirements

Compatible with __Windows PowerShell 5.1__ and [__PowerShell Core 7+__](https://github.com/PowerShell/PowerShell).
This module has no requirements and is fully compatible with __Windows PowerShell 5.1__ and [__PowerShell Core 7+__](https://github.com/PowerShell/PowerShell).

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion src/PSParallelPipeline/Commands/InvokeParallelCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace PSParallelPipeline;

[Cmdlet(VerbsLifecycle.Invoke, "Parallel")]
[Alias("parallel")]
[OutputType(typeof(PSObject))]
[OutputType(typeof(object))]
public sealed class InvokeParallelCommand : PSCmdlet, IDisposable
{
[Parameter(Position = 0, Mandatory = true)]
Expand Down

0 comments on commit 4b49371

Please sign in to comment.