From 9a99df2bed6083824088a787b1c2e054e2fff2c1 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Mon, 29 Jul 2019 14:05:33 -0400 Subject: [PATCH] Powershell changes --- .../Microsoft.PowerShell_profile.ps1 | 5 +- .../powershell/Microsoft.VSCode_profile.ps1 | 1 + .../powershell/PoshThemes/beantest.psm1 | 62 +++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 120000 link/nix/config/powershell/Microsoft.VSCode_profile.ps1 create mode 100644 link/nix/config/powershell/PoshThemes/beantest.psm1 diff --git a/link/nix/config/powershell/Microsoft.PowerShell_profile.ps1 b/link/nix/config/powershell/Microsoft.PowerShell_profile.ps1 index 2bed058..2812505 100644 --- a/link/nix/config/powershell/Microsoft.PowerShell_profile.ps1 +++ b/link/nix/config/powershell/Microsoft.PowerShell_profile.ps1 @@ -2,7 +2,10 @@ #Get-Module -ListAvailable PowerCLI.* | Import-Module # PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force -Import-Module '/Users/gene.liverman/.local/share/powershell/Modules/posh-git/1.0.0/posh-git.psd1' +#Import-Module '/Users/gene.liverman/.local/share/powershell/Modules/posh-git/1.0.0/posh-git.psd1' +Import-Module posh-git # Install-Module -Name oh-my-posh Import-module oh-my-posh +#Set-Theme Paradox +Set-Theme beantest diff --git a/link/nix/config/powershell/Microsoft.VSCode_profile.ps1 b/link/nix/config/powershell/Microsoft.VSCode_profile.ps1 new file mode 120000 index 0000000..967bf9d --- /dev/null +++ b/link/nix/config/powershell/Microsoft.VSCode_profile.ps1 @@ -0,0 +1 @@ +Microsoft.PowerShell_profile.ps1 \ No newline at end of file diff --git a/link/nix/config/powershell/PoshThemes/beantest.psm1 b/link/nix/config/powershell/PoshThemes/beantest.psm1 new file mode 100644 index 0000000..7738943 --- /dev/null +++ b/link/nix/config/powershell/PoshThemes/beantest.psm1 @@ -0,0 +1,62 @@ +#requires -Version 2 -Modules posh-git + +function Write-Theme { + param( + [bool] + $lastCommandFailed, + [string] + $with + ) + + $prompt = Write-Prompt -Object "$($sl.PromptSymbols.StartSymbol) " -ForegroundColor $sl.Colors.PromptForegroundColor + + If (!$env:_ -contains 'pwsh') { + $prompt += ' ' + } + + #check the last command state and indicate if failed + If ($lastCommandFailed) { + $prompt += Write-Prompt -Object "$($sl.PromptSymbols.FailedCommandSymbol) " -ForegroundColor $sl.Colors.CommandFailedIconForegroundColor + } + + #check for elevated prompt + If (Test-Administrator) { + $prompt += Write-Prompt -Object "$($sl.PromptSymbols.ElevatedSymbol) " -ForegroundColor $sl.Colors.AdminIconForegroundColor + } + + $computer = [System.Environment]::MachineName + $path = Get-FullPath -dir $pwd + $prompt += Write-Prompt -Object "$computer" -ForegroundColor $sl.Colors.SessionInfoForegroundColor + $prompt += Write-Prompt -Object ": " -ForegroundColor $sl.Colors.SessionInfoForegroundColor + + # Writes the drive portion + $prompt += Write-Prompt -Object "$path " + + $status = Get-VCSStatus + if ($status) { + $themeInfo = Get-VcsInfo -status ($status) + $prompt += Write-Prompt -Object " $($themeInfo.VcInfo) " -ForegroundColor $sl.Colors.GitForegroundColor + } + + $prompt += Set-Newline + + if ($with) { + $prompt += Write-Prompt -Object "$($with.ToUpper()) " -BackgroundColor $sl.Colors.WithBackgroundColor -ForegroundColor $sl.Colors.WithForegroundColor + } + $prompt += Write-Prompt -Object ($sl.PromptSymbols.PromptIndicator) -ForegroundColor $sl.Colors.PromptBackgroundColor + $prompt += ' ' + $prompt +} + +$sl = $global:ThemeSettings #local settings +$sl.PromptSymbols.StartSymbol = '☕️' +$sl.PromptSymbols.PromptIndicator = [char]::ConvertFromUtf32(0x276F) +$sl.PromptSymbols.SegmentForwardSymbol = [char]::ConvertFromUtf32(0xE0B0) +$sl.Colors.PromptForegroundColor = [ConsoleColor]::White +$sl.Colors.PromptSymbolColor = [ConsoleColor]::White +$sl.Colors.PromptHighlightColor = [ConsoleColor]::DarkBlue +$sl.Colors.GitForegroundColor = [ConsoleColor]::DarkBlue +$sl.Colors.WithForegroundColor = [ConsoleColor]::DarkRed +$sl.Colors.WithBackgroundColor = [ConsoleColor]::Magenta +$sl.Colors.VirtualEnvBackgroundColor = [System.ConsoleColor]::Red +$sl.Colors.VirtualEnvForegroundColor = [System.ConsoleColor]::White