Skip to content

Commit

Permalink
oh-my-posh3: Add version 3.58.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash258 committed Dec 22, 2020
1 parent a3ecd51 commit 0a16025
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 0 deletions.
Binary file added bucket/oh-my-posh3.json
Binary file not shown.
87 changes: 87 additions & 0 deletions support/oh-my-posh/Ash258.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh3/main/themes/schema.json",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "root",
"style": "plain",
"foreground": "#FFEE58"
},
{
"type": "session",
"style": "plain",
"foreground": "#ffffff",
"properties": {
"postfix": ""
}
},
{
"type": "envvar",
"style": "powerline",
"foreground": "#ffffff",
"properties": {
"var_name": "__POSH_PS_INFO__"
}
},
{
"type": "os",
"style": "plain",
"foreground": "#8E24AA"
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#91ddff",
"properties": {
"style": "short"
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#193549",
"background": "#95ffa4"
},
{
"type": "python",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#100e23",
"background": "#906cff",
"properties": {
"prefix": " \uE235 "
}
},
{
"type": "exit",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#ff8080",
"properties": {
"prefix": "\uE20F"
}
},
{
"type": "executiontime",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#8800dd",
"properties": {
"threshold": 500,
"style": "austin",
"prefix": " <#fefefe>\ufbab</> "
}
}
]
}
],
"final_space": true
}
48 changes: 48 additions & 0 deletions support/oh-my-posh/Hook.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[ScriptBlock] $Prompt = {
$lastCommandSuccess = $?
$realLASTEXITCODE = $global:LASTEXITCODE
$errorCode = 0
if ($lastCommandSuccess -eq $false) {
if ($realLASTEXITCODE -is [int] -and $realLASTEXITCODE -gt 0) {
$errorCode = $realLASTEXITCODE
} else {
$errorCode = 1
}
}

$executionTime = -1
$history = Get-History -ErrorAction 'Ignore' -Count 1
if ($null -ne $history -and $null -ne $history.EndExecutionTime -and $null -ne $history.StartExecutionTime) {
$executionTime = ($history.EndExecutionTime - $history.StartExecutionTime).TotalMilliseconds
}

# Custom ENVs
$_a = if ([intptr]::size -eq 4) { '32bit' } else { '64bit' }
$env:__POSH_PS_INFO__ = '@' + $PSVersionTable.PSVersion.ToString() + '@' + $_a

$posh = shovel prefix 'oh-my-posh3' --global
$exec = Join-Path $posh 'oh-my-posh.exe'
$startInfo = New-Object System.Diagnostics.ProcessStartInfo
$startInfo.FileName = $exec
$cleanPWD = $PWD.ProviderPath.TrimEnd('\')
$startInfo.Arguments = "-config=""$posh\themes\Ash258.json"" -error=$errorCode -pwd=""$cleanPWD"" -execution-time=$executionTime"
$startInfo.Environment['TERM'] = 'xterm-256color'
$startInfo.CreateNoWindow = $true
$startInfo.StandardOutputEncoding = [System.Text.Encoding]::UTF8
$startInfo.RedirectStandardOutput = $true
$startInfo.UseShellExecute = $false
if ($PWD.Provider.Name -eq 'FileSystem') {
$startInfo.WorkingDirectory = $PWD.ProviderPath
}
$process = New-Object System.Diagnostics.Process
$process.StartInfo = $startInfo
$process.Start() | Out-Null
$standardOut = $process.StandardOutput.ReadToEnd()
$process.WaitForExit()
$standardOut
$global:LASTEXITCODE = $realLASTEXITCODE
#remove temp variables
Remove-Variable realLASTEXITCODE -Confirm:$false
Remove-Variable lastCommandSuccess -Confirm:$false
}
Set-Item -Path Function:prompt -Value $Prompt -Force

0 comments on commit 0a16025

Please sign in to comment.