Skip to content

Commit 0a13568

Browse files
author
James Brundage
committed
feat: WebSocket Module source ( Fixes #7 )
1 parent af0c39e commit 0a13568

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

WebSocket.ps.psm1

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
$commandsPath = Join-Path $PSScriptRoot Commands
2+
[include('*-*')]$commandsPath
3+
4+
$myModule = $MyInvocation.MyCommand.ScriptBlock.Module
5+
$ExecutionContext.SessionState.PSVariable.Set($myModule.Name, $myModule)
6+
$myModule.pstypenames.insert(0, $myModule.Name)
7+
8+
New-PSDrive -Name $MyModule.Name -PSProvider FileSystem -Scope Global -Root $PSScriptRoot -ErrorAction Ignore
9+
10+
if ($home) {
11+
$MyModuleProfileDirectory = Join-Path ([Environment]::GetFolderPath("LocalApplicationData")) $MyModule.Name
12+
if (-not (Test-Path $MyModuleProfileDirectory)) {
13+
$null = New-Item -ItemType Directory -Path $MyModuleProfileDirectory -Force
14+
}
15+
New-PSDrive -Name "My$($MyModule.Name)" -PSProvider FileSystem -Scope Global -Root $MyModuleProfileDirectory -ErrorAction Ignore
16+
}
17+
18+
# Set a script variable of this, set to the module
19+
# (so all scripts in this scope default to the correct `$this`)
20+
$script:this = $myModule
21+
22+
#region Custom
23+
#endregion Custom
24+
25+
Export-ModuleMember -Alias * -Function * -Variable $myModule.Name
26+

0 commit comments

Comments
 (0)