From e811c60ab2433405c0cf12843f56eb2e16425b41 Mon Sep 17 00:00:00 2001 From: Jack Bennett Date: Wed, 18 Mar 2015 15:33:55 +0000 Subject: [PATCH] Leverage the Module Autoload path and save doing it ourselves. This should be faster too as we won't automatically import all functions to the session. Powershell now knows where to look before declaring they don't exist. --- vendor/profile.ps1 | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/vendor/profile.ps1 b/vendor/profile.ps1 index b463776..37ba2f2 100644 --- a/vendor/profile.ps1 +++ b/vendor/profile.ps1 @@ -1,18 +1,10 @@ -# Global modules directory -$global:PsGetDestinationModulePath = $PSScriptRoot + "\..\vendor\psmodules" +# Add Cmder modules directory to the autoload path. +$CmderModulePath = Join-path $PSScriptRoot "psmodules/" -# Push to modules location -Push-Location -Path ($PsGetDestinationModulePath) - -# Load modules from current directory -Import-Module .\PsGet\PsGet -Get-ChildItem -Exclude "PsGet" -Directory -Name | Foreach-Object { - Import-Module .\$_\$_ +if( -not $env:PSModulePath.Contains($CmderModulePath) ){ + $env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;") } -# Come back to PWD -Pop-Location - # Set up a Cmder prompt, adding the git prompt parts inside git repos function global:prompt { $realLASTEXITCODE = $LASTEXITCODE