Skip to content

Commit 217761a

Browse files
committed
Fix color error, and force Nuget update for posh-sshell installation
1 parent 183f408 commit 217761a

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

GitSetup.ps1

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ function CheckPowerShellVersion
3737
Write-Host "choco install powershell -y" -Foreground Gray
3838
Write-Error "You are not running PowerShell version 5+! Please upgrade."
3939
}
40+
41+
Install-PackageProvider NuGet -Force
42+
Import-PackageProvider NuGet -Force
4043
}
4144

4245
function CheckIfMsysIsInstallad
@@ -108,10 +111,7 @@ Start-SshAgent -Quiet
108111
`$env:home = `$env:userprofile
109112
110113
#Alias
111-
Set-Alias g git
112-
113-
Import-Module posh-sshell
114-
Start-SshAgent -Quiet
114+
Set-Alias g git
115115
"@
116116

117117
$text | out-file $global:PowerProfile
@@ -238,6 +238,15 @@ function SetupPoshGit
238238

239239
cd $currentFolder #back out
240240

241+
# Run when starting PowerShell
242+
$text = @"
243+
244+
Import-Module posh-sshell
245+
Start-SshAgent -Quiet
246+
"@
247+
248+
$text | out-file $global:PowerProfile -append
249+
241250
Write-Host "Install posh-sshell"
242251
PowerShellGet\Install-Module posh-sshell -Scope CurrentUser -Force
243252
}
@@ -251,11 +260,11 @@ function DownloadGitconfigContent2
251260
#Colors for PowerShell
252261
$text = @"
253262
254-
`$Global:GitPromptSettings.BeforeIndex.ForegroundColor = [ConsoleColor]::Green
255-
`$Global:GitPromptSettings.IndexColor.ForegroundColor = [ConsoleColor]::Green
256-
`$Global:GitPromptSettings.WorkingColor.ForegroundColor = [ConsoleColor]::Red
257-
`$Global:GitPromptSettings.LocalWorkingStatusSymbol.ForegroundColor = [ConsoleColor]::Red
258-
`$Global:GitPromptSettings.LocalDefaultStatusSymbol.ForegroundColor = [ConsoleColor]::Red
263+
`$Global:GitPromptSettings.BeforeIndexForegroundColor = [ConsoleColor]::Green
264+
`$Global:GitPromptSettings.IndexForegroundColor = [ConsoleColor]::Green
265+
`$Global:GitPromptSettings.WorkingForegroundColor = [ConsoleColor]::Red
266+
`$Global:GitPromptSettings.LocalWorkingStatusForegroundColor = [ConsoleColor]::Red
267+
`$Global:GitPromptSettings.LocalDefaultStatusForegroundColor = [ConsoleColor]::Red
259268
"@
260269

261270
$text | out-file $global:PowerProfile -append

0 commit comments

Comments
 (0)