Skip to content

Commit b1961df

Browse files
author
James Brundage
committed
chore: Moving Commands into /Commands ( Fixes #210 )
1 parent 59d4202 commit b1961df

11 files changed

Lines changed: 48 additions & 10 deletions
File renamed without changes.
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,12 @@
312312
}
313313
}
314314
} else {
315-
$MyInvocation.MyCommand.ScriptBlock.File | Split-Path
315+
if ($MyInvocation.MyCommand.ScriptBlock.Module) {
316+
$MyInvocation.MyCommand.ScriptBlock.Module | Split-Path
317+
} else {
318+
$MyInvocation.MyCommand.ScriptBlock.File | Split-Path | Split-Path
319+
}
320+
316321
}
317322
}
318323
#endregion Determine the Path List
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Irregular.ps.psm1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
$CommandsPath = Join-Path $PSScriptRoot Commands
2+
[include('*-*.ps1')]$CommandsPath
3+
4+
Import-RegEx
5+
6+
foreach ($k in $script:_RegexLibrary.Keys) {
7+
Set-Alias -Name "?<$k>" -Value Use-RegEx
8+
}
9+
10+
$MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = {
11+
if ($script:_RegexTempModules -and $script:_RegexTempModules.Count) {
12+
@($script:_RegexTempModules) | Remove-Module
13+
}
14+
}
15+
16+
$MyInvocation.MyCommand.ScriptBlock.Module |
17+
Add-Member NoteProperty Splicers @{
18+
'\?\<(?<Name>\w+)\>' = {
19+
$out = "[Regex]::new(@'" + [Environment]::NewLine + (
20+
Get-RegEx -Name $input.name |
21+
Select-Object -ExpandProperty Pattern) + "'@, 'IgnoreCase,IgnorePatternWhitespace')"
22+
$out
23+
}
24+
}
25+
26+
Set-Alias ?<> New-RegEx
27+
Set-Alias Write-RegEx New-RegEx
28+
Set-Alias ?<.> Use-Regex
29+
30+
Export-ModuleMember -Function *-* -Alias *

0 commit comments

Comments
 (0)