-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
for #16
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Alternate PSModulesPath (User) | ||
if ($isWindows) { | ||
$LocalAppDataModulePath = Join-Path -Path $env:LOCALAPPDATA -ChildPath 'PowerShell\Modules' | ||
if (-not(Test-Path -Path $LocalAppDataModulePath)) { | ||
New-Item -Path $LocalAppDataModulePath -ItemType Directory -Force | ||
} | ||
# Add to Start of PSModulePath | ||
$env:PSModulePath = $LocalAppDataModulePath + [IO.Path]::PathSeparator + $env:PSModulePath | ||
} | ||
|
||
$ProfileModulesToImport = @( | ||
'PSReadLine' | ||
'posh-git' | ||
'Terminal-Icons' | ||
'PSFzf' | ||
'PSEverything' | ||
'CompletionPredictor' | ||
'Microsoft.PowerShell.ConsoleGuiTools' | ||
'F7History' | ||
) | ||
|
||
ForEach ($Mod in $ProfileModulesToImport) { | ||
try { | ||
Write-Verbose "Importing Module: $Mod" | ||
Import-Module $Mod -ErrorAction Stop | ||
} catch { | ||
Write-Warning "Failed to install module: $Mod" | ||
try { | ||
Install-PSResource $Mod -Scope CurrentUser -Force -ErrorAction Stop | ||
} catch { | ||
Write-Warning "Failed to install module: $Mod" | ||
Continue | ||
} | ||
} finally { | ||
Import-Module -Name $Mod -ErrorAction SilentlyContinue | ||
} | ||
} | ||
|
||
if (Get-PSResource -Name ZLocation) { | ||
Import-Module ZLocation | ||
Write-Host -Foreground Green "`n[ZLocation] knows about $((Get-ZLocation).Keys.Count) locations.`n" | ||
} |