Skip to content

Commit 7c8a3e6

Browse files
Merge pull request #14 from StartAutomating/NewEvents
New event - On@LocationChanged
2 parents 0170be4 + 58ff273 commit 7c8a3e6

46 files changed

Lines changed: 689 additions & 167 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
## 0.1.6
2+
* Adding LocationChanged event source (Fixes #12)
3+
4+
---
5+
16
## 0.1.5
27
* Adding On@Event (#2)
38
* Send-Event support for piping existing events (#4)
49
* Adding /docs (#5)
10+
511
---
12+
613
## 0.1.4
714

815
* Module Rebranded to Eventful.
916
* Get-EventHandler added
17+
1018
---
19+
1120
## 0.1.3
1221
New Event Source:
1322
* VariableSet
@@ -16,18 +25,24 @@ Receive-Event now returns event most-recent to least-recent.
1625
Receive-Event now has -First and -Skip.
1726

1827
Bugfix: On@Repeat now actually starts it's timer.
28+
1929
---
30+
2031
## 0.1.2
2132
New Event Source:
2233
* UDP
2334

2435
PowerShellAsync Event Source now allows for a -Parameter dictionaries.
36+
2537
---
38+
2639
## 0.1.1
2740
New Event Sources:
2841
* HTTPResponse
2942
* PowerShellAsync
43+
3044
---
45+
3146
New Event Source Capabilities:
3247

3348
Event Sources can now return an InitializeEvent property or provide a ComponentModel.InitializationEvent attribute.
@@ -38,4 +53,6 @@ Initial Module Release.
3853

3954
Fun simple event syntax (e.g. on mysignal {"do this"} or on delay "00:00:01" {"do that"})
4055
Better pipelining support for Sending events.
56+
4157
---
58+
'@

EventSources/@Event.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
.Synopsis
33
Watches for new events.
44
.Description
5+
Watches for any new events.
56
7+
Subscribing to this event will preempt all other events.
68
#>
79
[Diagnostics.Tracing.EventSource(Name='PSEventReceived')]
810
param()

EventSources/@LocationChanged.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<#
2+
.Synopsis
3+
Sends events when the directory changes.
4+
.Description
5+
Sends events when the PowerShell current directory changes.
6+
.EXAMPLE
7+
On@LocationChanged
8+
.EXAMPLE
9+
On@LocationChanged -Then { $event | Out-Host }
10+
#>
11+
param()
12+
13+
process {
14+
$global:ExecutionContext.SessionState.InvokeCommand.LocationChangedAction = {
15+
param($LocationChangedArgs)
16+
17+
New-Event -SourceIdentifier "PowerShell.LocationChanged" $LocationChangedArgs -Sender $ExecutionContext
18+
}
19+
[PSCustomObject]@{
20+
SourceIdentifier = "PowerShell.LocationChanged"
21+
}
22+
}

Eventful.HelpOut.ps1

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ if ($EventfulLoaded) {
1212
}
1313

1414
Save-MarkdownHelp -Module Eventful -OutputPath $wikiPath -ScriptPath '@*' -ReplaceScriptName '^@',
15-
'\.ps1$' -ReplaceScriptNameWith '',"-EventSource" -SkipCommandType Alias -PassThru -IncludeTopic *.help.txt |
16-
Add-Member -Name CommitMessage -MemberType ScriptProperty -value { "Updating $($this.Name) [skip ci]" } -Force -PassThru
15+
'\.ps1$' -ReplaceScriptNameWith '',"-EventSource" -SkipCommandType Alias -PassThru -IncludeTopic *.help.txt
1716

1817
Pop-Location

Eventful.psd1

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22
RootModule = 'Eventful.psm1'
33
Description = 'Easy Eventful Asynchronous Scripting with PowerShell'
4-
ModuleVersion = '0.1.5'
4+
ModuleVersion = '0.1.6'
55
GUID = 'f4d780da-be78-49c6-921a-436e053cb97c'
66
Author = 'James Brundage'
77
Copyright = '2021 Start-Automating'
@@ -16,16 +16,25 @@
1616
Tags = 'Eventful', 'Events'
1717

1818
ReleaseNotes = @'
19+
## 0.1.6
20+
* Adding LocationChanged event source (Fixes #12)
21+
22+
---
23+
1924
## 0.1.5
2025
* Adding On@Event (#2)
2126
* Send-Event support for piping existing events (#4)
2227
* Adding /docs (#5)
28+
2329
---
30+
2431
## 0.1.4
2532
2633
* Module Rebranded to Eventful.
2734
* Get-EventHandler added
35+
2836
---
37+
2938
## 0.1.3
3039
New Event Source:
3140
* VariableSet
@@ -34,18 +43,24 @@ Receive-Event now returns event most-recent to least-recent.
3443
Receive-Event now has -First and -Skip.
3544
3645
Bugfix: On@Repeat now actually starts it's timer.
46+
3747
---
48+
3849
## 0.1.2
3950
New Event Source:
4051
* UDP
4152
4253
PowerShellAsync Event Source now allows for a -Parameter dictionaries.
54+
4355
---
56+
4457
## 0.1.1
4558
New Event Sources:
4659
* HTTPResponse
4760
* PowerShellAsync
61+
4862
---
63+
4964
New Event Source Capabilities:
5065
5166
Event Sources can now return an InitializeEvent property or provide a ComponentModel.InitializationEvent attribute.
@@ -56,6 +71,7 @@ Initial Module Release.
5671
5772
Fun simple event syntax (e.g. on mysignal {"do this"} or on delay "00:00:01" {"do that"})
5873
Better pipelining support for Sending events.
74+
5975
---
6076
'@
6177
}
@@ -72,6 +88,7 @@ Better pipelining support for Sending events.
7288
'VariableSet' = 'EventSources/@VariableSet.ps1'
7389
'UDP' = 'EventSources/@UDP.ps1'
7490
'Event' = 'EventSources/@Event.ps1'
91+
'LocationChanged' = 'EventSources/@LocationChanged.ps1'
7592
}
7693
}
7794
}

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,6 @@
44
Easy Eventful Asynchronous Scripting with PowerShell
55
----------------
66

7-
### Commands
8-
-----------------------
9-
| Verb|Noun |
10-
|------:|:------------|
11-
| Clear|-EventSource |
12-
| Get|-EventHandler|
13-
| |-EventSource |
14-
|Receive|-Event |
15-
| Send|-Event |
16-
| Watch|-Event |
17-
-----------------------
187
### Getting Started with Eventful
198

209

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Clear-EventSource.ps1
22

33

4+

docs/Clear-EventSource.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ Clears any active subscriptions for any event source.
1212
---
1313
### Related Links
1414
* [Get-EventSource](Get-EventSource.md)
15+
16+
17+
1518
---
1619
### Examples
1720
#### EXAMPLE 1
@@ -27,9 +30,16 @@ The name of the event source.
2730

2831

2932

30-
|Type |Requried|Postion|PipelineInput |
31-
|----------------|--------|-------|---------------------|
32-
|```[String[]]```|false |1 |true (ByPropertyName)|
33+
> **Type**: ```[String[]]```
34+
35+
> **Required**: false
36+
37+
> **Position**: 1
38+
39+
> **PipelineInput**:true (ByPropertyName)
40+
41+
42+
3343
---
3444
#### **WhatIf**
3545
-WhatIf is an automatic variable that is created when a command has ```[CmdletBinding(SupportsShouldProcess)]```.
@@ -45,7 +55,9 @@ If the command sets a ```[ConfirmImpact("Medium")]``` which is lower than ```$co
4555

4656
---
4757
### Outputs
48-
System.Nullable
58+
* [Nullable](https://learn.microsoft.com/en-us/dotnet/api/System.Nullable)
59+
60+
4961

5062

5163
---

docs/Delay-EventSource.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@ The amount of time to wait
2424

2525

2626

27-
|Type |Requried|Postion|PipelineInput |
28-
|----------------|--------|-------|---------------------|
29-
|```[TimeSpan]```|true |1 |true (ByPropertyName)|
27+
> **Type**: ```[TimeSpan]```
28+
29+
> **Required**: true
30+
31+
> **Position**: 1
32+
33+
> **PipelineInput**:true (ByPropertyName)
34+
35+
36+
3037
---
3138
### Syntax
3239
```PowerShell
@@ -35,3 +42,4 @@ The amount of time to wait
3542
---
3643

3744

45+

docs/Event-EventSource.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Watches for new events.
66

77
---
88
### Description
9+
10+
Watches for any new events.
11+
12+
Subscribing to this event will preempt all other events.
13+
914
---
1015
### Syntax
1116
```PowerShell
@@ -14,3 +19,5 @@ EventSources/@Event.ps1 [<CommonParameters>]
1419
---
1520

1621

22+
23+

0 commit comments

Comments
 (0)