Setup updates
This commit is contained in:
parent
a2888a883b
commit
179f617bac
|
@ -13,6 +13,7 @@
|
|||
)
|
||||
|
||||
|
||||
function LoadProfileCodeFunctions {
|
||||
#######################################################################
|
||||
## ProfileCode function (source) will contain the code to be written
|
||||
#######################################################################
|
||||
|
@ -355,7 +356,17 @@ $env:PATH = $p2 -join $PathEnvDelimiter
|
|||
Write-Verbose "PATH $(if( $p1.Count -eq $p2.Count ) { "modification" } else { "was modified"} )"
|
||||
Remove-Variable -Name "p1","p2","My_PSScriptRoot"
|
||||
}
|
||||
function ProfileCode_cleanup { [CmdletBinding()]param(
|
||||
[switch]$Full
|
||||
)
|
||||
Remove-Item function:ProfileCode* -Confirm:$false
|
||||
if( $Full ) {
|
||||
Remove-Item function:LoadProfileCodeFunctions -Confirm:$false
|
||||
}
|
||||
}
|
||||
|
||||
. ProfileCode_common
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
## _Init Logic - writing starts here
|
||||
|
@ -375,6 +386,8 @@ function _Init {
|
|||
[switch]$NoReloadScripts
|
||||
)
|
||||
|
||||
. LoadProfileCodeFunctions
|
||||
|
||||
if ( -not $NoGitAction ) {
|
||||
if ( -not [bool]$(Get-Command git -ErrorAction SilentlyContinue) ) {
|
||||
throw "No git command found, you may either omit run with the -NoGitAction switch or install git and try again."
|
||||
|
@ -555,16 +568,18 @@ function _Init {
|
|||
}
|
||||
|
||||
Get-Item function:_Init | Remove-Item -Confirm:$false
|
||||
. ProfileCode_cleanup -Full
|
||||
}
|
||||
|
||||
. ProfileCode_common
|
||||
. LoadProfileCodeFunctions
|
||||
|
||||
if( -not $MyPSScriptRoot ) { throw '$MyPSScriptRoot does NOT exist!' }
|
||||
|
||||
if( $WriteInitScript ) {
|
||||
_Init @PSBoundParameters
|
||||
}
|
||||
|
||||
Remove-Item function:ProfileCode* -Confirm:$false
|
||||
. ProfileCode_cleanup
|
||||
|
||||
if( $NoReloadScripts ) { return }
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Set-PowerLinePrompt -PowerLineFont
|
||||
|
||||
$local:MyPowerLineSetup = [ordered]@{
|
||||
Title = { "Sz PS" }
|
||||
Title = { "PSz" }
|
||||
SetCurrentDirectory = $true
|
||||
RestoreVirtualTerminal = $true
|
||||
PowerLineCharacters = [ordered]@{
|
||||
|
@ -40,13 +40,22 @@ $local:MyPowerLineSetup = [ordered]@{
|
|||
# Right-align block
|
||||
{ "`t" }
|
||||
{ "$($PromptCache.Username)@$($PromptCache.Hostname)" }
|
||||
{ Get-Elapsed -Trim }
|
||||
{
|
||||
(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)' }
|
||||
{ "$PSOSName " }
|
||||
{ "$($PromptCache.OSName) " }
|
||||
|
||||
{ "`n" }
|
||||
{ New-PromptText { "PS" } -Bg $Prompt.Colors[1] -Ebg Red }
|
||||
{ New-PromptText { "PS" } -Bg $Prompt.Colors[1] -Ebg Red; }
|
||||
)
|
||||
}
|
||||
Set-PowerLinePrompt @MyPowerLineSetup
|
||||
|
|
Loading…
Reference in New Issue