Cleaner prompt, Reload-MyScripts -Update switch
This commit is contained in:
parent
6ff3357c58
commit
532f82775b
|
@ -1,4 +1,6 @@
|
||||||
[CmdletBinding(SupportsShouldProcess)]param()
|
[CmdletBinding(SupportsShouldProcess)]param(
|
||||||
|
[switch]$Update
|
||||||
|
)
|
||||||
|
|
||||||
function RemoveAlias {
|
function RemoveAlias {
|
||||||
param([string]$Name)
|
param([string]$Name)
|
||||||
|
@ -23,6 +25,13 @@ function SafeSetAlias {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( $Update -and (Get-Command git -ErrorAction Ignore) ) {
|
||||||
|
Push-Location $MyPSScriptRoot
|
||||||
|
git pull
|
||||||
|
if( Get-Command Write-VcsStatus -ErrorAction Ignore ) { Write-Host "`n$(Write-VcsStatus)`n" }
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
try { Get-Alias Get-MyAliases -ErrorAction Stop | ForEach-Object { . RemoveAlias $($_.Name) } } catch {}
|
try { Get-Alias Get-MyAliases -ErrorAction Stop | ForEach-Object { . RemoveAlias $($_.Name) } } catch {}
|
||||||
function Get-MyAliases {
|
function Get-MyAliases {
|
||||||
[CmdletBinding()]param([switch]$ScriptsOnly)
|
[CmdletBinding()]param([switch]$ScriptsOnly)
|
||||||
|
|
|
@ -20,7 +20,7 @@ $local:MyPowerLineSetup = [ordered]@{
|
||||||
{ New-PromptText -EBg VioletRed4 $MyInvocation.HistoryId }
|
{ New-PromptText -EBg VioletRed4 $MyInvocation.HistoryId }
|
||||||
{ Get-Elapsed -Trim }
|
{ Get-Elapsed -Trim }
|
||||||
{ Get-SegmentedPath -LengthLimit 30 }
|
{ Get-SegmentedPath -LengthLimit 30 }
|
||||||
{ if( Get-GitStatus ) { "$([PoshCode.Pansies.Entities]::ExtendedCharacters.Branch)$(Write-VcsStatus)" } }
|
{ Write-VcsStatus }
|
||||||
|
|
||||||
# Right-align block
|
# Right-align block
|
||||||
{ "`t" }
|
{ "`t" }
|
||||||
|
@ -35,4 +35,4 @@ $local:MyPowerLineSetup = [ordered]@{
|
||||||
}
|
}
|
||||||
Set-PowerLinePrompt @MyPowerLineSetup
|
Set-PowerLinePrompt @MyPowerLineSetup
|
||||||
|
|
||||||
Write-Host -ForegroundColor Cyan "PowerLine Theme is ready, if you want to persist it, don't forget to run Export-PowerLinePrompt"
|
Write-Host -ForegroundColor Cyan "PowerLine Theme is ready, if you want to persist it, don't forget to run Export-PowerLinePrompt`n"
|
||||||
|
|
|
@ -10,8 +10,11 @@ Get-Command -ListImported Set-PSReadLineKeyHandler -ErrorAction SilentlyContinue
|
||||||
if( (Get-Command -ListImported Set-PowerLinePrompt -ErrorAction Ignore) ) {
|
if( (Get-Command -ListImported Set-PowerLinePrompt -ErrorAction Ignore) ) {
|
||||||
$global:PSOSName = [SystemName]::_GetValidValues("",$true,$true) | Select-Object -First 1
|
$global:PSOSName = [SystemName]::_GetValidValues("",$true,$true) | Select-Object -First 1
|
||||||
|
|
||||||
|
if( Get-Command -ListImported Get-GitDirectory -ErrorAction Ignore ) { $null = Get-GitDirectory }
|
||||||
if( Test-Path variable:global:GitPromptSettings ) {
|
if( Test-Path variable:global:GitPromptSettings ) {
|
||||||
$global:GitPromptSettings.TruncatedBranchSuffix = [char]0x2026
|
$global:GitPromptSettings.TruncatedBranchSuffix = [char]0x2026
|
||||||
|
$global:GitPromptSettings.BeforeStatus.Text = [PoshCode.Pansies.Entities]::ExtendedCharacters.Branch
|
||||||
|
$global:GitPromptSettings.AfterStatus.Text = [string]::Empty
|
||||||
}
|
}
|
||||||
Set-PowerLinePrompt
|
Set-PowerLinePrompt
|
||||||
} elseif( (Get-Command -ListImported Set-PoshPrompt -ErrorAction Ignore) -and $IsOutputANSICompatible ) {
|
} elseif( (Get-Command -ListImported Set-PoshPrompt -ErrorAction Ignore) -and $IsOutputANSICompatible ) {
|
||||||
|
|
Loading…
Reference in New Issue