Functions/Import-MyModule.ps1
function Import-MyModule { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [ArgumentCompleter( { param ( $commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameters ) Get-ChildItem "$(Join-Path $($env:USERPROFILE) -ChildPath "Git\")$wordToComplete*" -Directory -Name | ForEach-Object { "`"$_`"" } } )] [ValidateScript( { $_ -in (Get-ChildItem "$(Join-Path $($env:USERPROFILE) -ChildPath "Git\")" -Directory -Name) } ) ] [string] $Module ) $ModuleManifest = "$(Join-Path $($env:USERPROFILE) -ChildPath "Git")\$($Module)\$Module.psd1" if (Test-Path $ModuleManifest) { Import-Module $ModuleManifest -Force -Global } } |