1
- $myGitDirectory = Join-Path $PSScriptRoot .git
2
- if (Test-Path $myGitDirectory ) {
3
- $commandsPath = Join-Path $PSScriptRoot Commands
4
- Write-Verbose " Git directory found, loading commands from $commandsPath "
5
- :ToIncludeFiles foreach ($file in (Get-ChildItem - Path " $commandsPath " - Filter " *-*" - Recurse)) {
6
- if ($file.Extension -ne ' .ps1' ) { continue } # Skip if the extension is not .ps1
7
- foreach ($exclusion in ' \.[^\.]+\.ps1$' ) {
8
- if (-not $exclusion ) { continue }
9
- if ($file.Name -match $exclusion ) {
10
- continue ToIncludeFiles # Skip excluded files
11
- }
12
- }
13
- . $file.FullName
14
- }
15
- } else {
16
- Write-Verbose " Git directory not found, loading allcommands.ps1"
17
- . (Join-Path $PSScriptRoot " allcommands.ps1" )
1
+ $commandsPath = Join-Path $PSScriptRoot Commands
2
+ :ToIncludeFiles foreach ($file in (Get-ChildItem - Path " $commandsPath " - Filter " *-*" - Recurse)) {
3
+ if ($file.Extension -ne ' .ps1' ) { continue } # Skip if the extension is not .ps1
4
+ foreach ($exclusion in ' \.[^\.]+\.ps1$' ) {
5
+ if (-not $exclusion ) { continue }
6
+ if ($file.Name -match $exclusion ) {
7
+ continue ToIncludeFiles # Skip excluded files
8
+ }
9
+ }
10
+ . $file.FullName
18
11
}
19
12
20
-
21
13
$myModule = $MyInvocation.MyCommand.ScriptBlock.Module
22
14
$ExecutionContext.SessionState.PSVariable.Set ($myModule.Name , $myModule )
23
15
$myModule.pstypenames.insert (0 , $myModule.Name )
@@ -32,8 +24,6 @@ if ($home) {
32
24
New-PSDrive - Name " My$ ( $MyModule.Name ) " - PSProvider FileSystem - Scope Global - Root $MyModuleProfileDirectory - ErrorAction Ignore
33
25
}
34
26
35
- $KnownVerbs = Get-Verb | Select-Object - ExpandProperty Verb
36
-
37
27
# Set a script variable of this, set to the module
38
28
# (so all scripts in this scope default to the correct `$this`)
39
29
$script :this = $myModule
0 commit comments