Introducting PowerLine module
Added ExistingModules to packages, for module dependent package manifest Moved PowerLine styling code to the PowerLine pacakge. Added Package install code generation to Get-MyModules. Fixed typo in EnsureJoinString Fixed: Scoop operations would fail calling internal url function.
This commit is contained in:
parent
c7ec1e8c5d
commit
b0ec8e1780
9 changed files with 68 additions and 29 deletions
64
PowerLine/Setup-MyPowerLineTheme.ps1
Normal file
64
PowerLine/Setup-MyPowerLineTheme.ps1
Normal file
|
@ -0,0 +1,64 @@
|
|||
Set-PowerLinePrompt -PowerLineFont
|
||||
|
||||
$local:MyPowerLineSetup = [ordered]@{
|
||||
Title = { "PSz" }
|
||||
SetCurrentDirectory = $true
|
||||
RestoreVirtualTerminal = $true
|
||||
PowerLineCharacters = [ordered]@{
|
||||
ColorSeparator = "$(
|
||||
$PromptCache.ColorFiller
|
||||
)$( $PromptCache.Separator.Trim()
|
||||
)$( " "
|
||||
)"
|
||||
ReverseColorSeparator = "$(
|
||||
" "
|
||||
)$( $PromptCache.ReverseSeparator.Trim()
|
||||
)$( $PromptCache.ColorFiller
|
||||
)"
|
||||
Separator = $(
|
||||
[PoshCode.Pansies.Entities]::NerdFonts['nf-fa-angle_right']
|
||||
)
|
||||
ReverseSeparator = $(
|
||||
[PoshCode.Pansies.Entities]::NerdFonts['nf-fa-angle_left']
|
||||
)
|
||||
}
|
||||
Colors = [PoshCode.Pansies.RgbColor]::X11Palette |
|
||||
Where-Object X11ColorName -match "^Gray\d" |
|
||||
Sort-Object X11ColorName -Unique |
|
||||
Where-Object {
|
||||
0 -eq $([int]($_.X11ColorName -replace 'Gray','') % 11)
|
||||
}
|
||||
#@( [rgbcolor]"Grey18", [rgbcolor]"Grey65" )
|
||||
#([rgbcolor]::ConsolePalette | Where ConsoleColor -eq ((get-host).ui.rawui.BackgroundColor)),
|
||||
#@( [rgbcolor]"Grey18", [rgbcolor]"Grey65" ) #, [rgbcolor]"white", [rgbcolor]"red", [rgbcolor]"blue" )
|
||||
Prompt = @(
|
||||
{ Write-Host "" } # A spaced line without a ColorSeparator
|
||||
{ New-PromptText -EBg VioletRed4 $MyInvocation.HistoryId }
|
||||
{ Get-SegmentedPath -LengthLimit 37 }
|
||||
{ Write-VcsStatus }
|
||||
|
||||
# Right-align block
|
||||
{ "`t" }
|
||||
{ "$($PromptCache.Username)@$($PromptCache.Hostname)" }
|
||||
{
|
||||
(Get-Elapsed -Format "{0:d\:h\:m\:s\.ffff}") `
|
||||
-replace '\.(\d{1,3})\d*$','s $1ms' `
|
||||
-replace '\:([^:]*)$','m $1' `
|
||||
-replace ':([^:]*)','d $1' `
|
||||
-replace '\b0+[dms]\b ','' `
|
||||
-replace '( ?)\b0+(\d+ms)$','$1$2' `
|
||||
-replace ' ?0ms','' `
|
||||
-replace '^ *$','0'
|
||||
}
|
||||
{ Get-Date -Format 'HH:mm:ss' }
|
||||
{ Get-Date -Format 'ddd(dd)' }
|
||||
{ "$($PromptCache.OSName) " }
|
||||
|
||||
{ "`n" }
|
||||
{ New-PromptText { "PS" } -Bg $Prompt.Colors[1] -Ebg Red; }
|
||||
)
|
||||
}
|
||||
Set-PowerLinePrompt @MyPowerLineSetup
|
||||
|
||||
Write-Host -ForegroundColor Cyan "PowerLine Theme is ready, if you want to persist it, don't forget to run Export-PowerLinePrompt`n"
|
||||
|
19
PowerLine/_.package.json
Normal file
19
PowerLine/_.package.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"package": {
|
||||
"Name": "PowerLine",
|
||||
"Condition": [
|
||||
{
|
||||
"custom": null,
|
||||
"System": null,
|
||||
"Hostname": null,
|
||||
"Username": null,
|
||||
"ModuleExists": [
|
||||
"Pansies",
|
||||
"PowerLine"
|
||||
],
|
||||
"AppExeExists": null,
|
||||
"Logic": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
3
PowerLine/profile.d/FixScoopBug.ps1
Normal file
3
PowerLine/profile.d/FixScoopBug.ps1
Normal file
|
@ -0,0 +1,3 @@
|
|||
Import-Module PowerLine
|
||||
Import-Module Pansies
|
||||
Get-Item alias:url | Where-Object Source -eq Pansies | % { Remove-Item "alias:$($_.Name)" }
|
24
PowerLine/profile.d/Style.ps1
Normal file
24
PowerLine/profile.d/Style.ps1
Normal file
|
@ -0,0 +1,24 @@
|
|||
if( -not (Get-Command -ListImported Set-PowerLinePrompt -ErrorAction Ignore) ) { return }
|
||||
|
||||
$global:PromptCache = [ordered]@{
|
||||
OSName = [SystemName]::_GetValidValues("",$true,$true) | Select-Object -First 1
|
||||
Username = @($env:USER, $env:USERNAME -ne "")[0]
|
||||
Hostname = $(hostname).Trim()
|
||||
ColorFiller = $([char]0x2588)
|
||||
Separator = " $(
|
||||
[PoshCode.Pansies.Entities]::NerdFonts['nf-pl-left_hard_divider']
|
||||
)"
|
||||
ReverseSeparator = "$(
|
||||
[PoshCode.Pansies.Entities]::NerdFonts['nf-pl-right_hard_divider']
|
||||
) "
|
||||
# Separator = "$(
|
||||
# [char]::ConvertFromUtf32(0x2588)
|
||||
# )$( [PoshCode.Pansies.Entities]::ExtendedCharacters.ColorSeparator.Trim()[-1]
|
||||
# ) "
|
||||
# ReverseSeparator = " $(
|
||||
# [PoshCode.Pansies.Entities]::ExtendedCharacters.ColorSeparator.Trim()[0]
|
||||
# )$( [char]::ConvertFromUtf32(0x2588))"
|
||||
|
||||
}
|
||||
|
||||
Set-PowerLinePrompt
|
Loading…
Add table
Add a link
Reference in a new issue