Created
February 25, 2015 19:10
-
-
Save DoggettCK/472ab258a041283c4da7 to your computer and use it in GitHub Desktop.
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
# Make sure we're installing into user's own Powershell Module path, and not the global one | |
$PSModuleDir = "$($ENV:PsModulePath)".Split(";") | Select-String "$ENV:UserName" | foreach {$_.Line } | Select-Object -First 1 | |
function ModuleInstalled([parameter(Mandatory=$true)][string] $moduleName) { | |
return ((Get-Module "$moduleName") -ne $null) | |
} | |
function InstallPlugins([parameter(Mandatory=$true)][string[]] $moduleNames) { | |
if (-NOT (Test-Path "$PSModuleDir\PsGet\PsGet.psm1")) { | |
New-Item -ItemType Directory -Force -Path "$PSModuleDir\PsGet" | Out-Null | |
Add-Content -Path "$PSModuleDir\PsGet\PsGet.psm1" -Value (New-Object Net.WebClient).DownloadString("https://raw.githubusercontent.com/psget/psget/master/PsGet/PsGet.psm1") | |
} | |
foreach ($moduleName in $moduleNames) { | |
if (-NOT (ModuleInstalled "$moduleName" )) { | |
Install-Module "$moduleName" | Out-Null | |
} | |
} | |
} | |
InstallPlugins(@("PSReadline", "Posh-Git")) | |
if ($host.Name -eq 'ConsoleHost') { | |
if (ModuleInstalled("PSReadline")) | |
{ | |
Import-Module "PSReadline" | |
Set-PSReadlineOption -EditMode Emacs | |
} | |
if (ModuleInstalled("Posh-Git")) { | |
# Load posh-git example profile | |
. "$PSModuleDir\posh-git\profile.example.ps1" | |
$GitPromptSettings.EnableFileStatus = $false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment