mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-09 20:44:03 -08:00
parent
0bd957fc76
commit
35c76bdf75
|
@ -113,8 +113,8 @@ func init() { // nolint:gochecknoinits
|
|||
printCmd.Flags().StringVar(&pwd, "pwd", "", "current working directory")
|
||||
printCmd.Flags().StringVar(&pswd, "pswd", "", "current working directory (according to pwsh)")
|
||||
printCmd.Flags().StringVar(&shell, "shell", "", "the shell to print for")
|
||||
printCmd.Flags().IntVarP(&exitCode, "exit", "e", 0, "last exit code")
|
||||
printCmd.Flags().Float64VarP(&timing, "timing", "t", 0, "timing of the last command")
|
||||
printCmd.Flags().IntVarP(&exitCode, "error", "e", 0, "last exit code")
|
||||
printCmd.Flags().Float64Var(&timing, "execution-time", 0, "timing of the last command")
|
||||
printCmd.Flags().IntVarP(&stackCount, "stack-count", "s", 0, "number of locations on the stack")
|
||||
printCmd.Flags().IntVarP(&terminalWidth, "terminal-width", "w", 0, "width of the terminal")
|
||||
printCmd.Flags().StringVar(&command, "command", "", "tooltip command")
|
||||
|
|
|
@ -25,7 +25,7 @@ function _omp_hook() {
|
|||
omp_elapsed=$((omp_now-omp_start_time))
|
||||
rm -f "$TIMER_START"
|
||||
fi
|
||||
PS1="$(::OMP:: prompt print primary --config="$POSH_THEME" --shell=bash --exit="$ret" --timing="$omp_elapsed" --stack-count="$omp_stack_count" | tr -d '\0')"
|
||||
PS1="$(::OMP:: prompt print primary --config="$POSH_THEME" --shell=bash --error="$ret" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" | tr -d '\0')"
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
|
|
@ -18,11 +18,11 @@ function fish_prompt
|
|||
set -gx omp_last_status_generation $status_generation
|
||||
end
|
||||
|
||||
::OMP:: prompt print primary --config $POSH_THEME --shell fish --exit $omp_status_cache --timing $omp_duration --stack-count $omp_stack_count
|
||||
::OMP:: prompt print primary --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
|
||||
end
|
||||
|
||||
function fish_right_prompt
|
||||
::OMP:: prompt print right --config $POSH_THEME --shell fish --exit $omp_status_cache --timing $omp_duration --stack-count $omp_stack_count
|
||||
::OMP:: prompt print right --config $POSH_THEME --shell fish --error $omp_status_cache --execution-time $omp_duration --stack-count $omp_stack_count
|
||||
end
|
||||
|
||||
function postexec_omp --on-event fish_postexec
|
||||
|
|
|
@ -61,14 +61,14 @@ end
|
|||
|
||||
local function execution_time_option()
|
||||
if last_duration ~= nil then
|
||||
return "--timing "..last_duration
|
||||
return "--execution-time "..last_duration
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
||||
local function error_level_option()
|
||||
if os.geterrorlevel ~= nil and settings.get("cmd.get_errorlevel") then
|
||||
return "--exit "..os.geterrorlevel()
|
||||
return "--error "..os.geterrorlevel()
|
||||
end
|
||||
return ""
|
||||
end
|
||||
|
|
|
@ -94,7 +94,7 @@ function global:Initialize-ModuleSupport {
|
|||
$global:omp_lastHistoryId = $history.Id
|
||||
}
|
||||
$terminalWidth = $Host.UI.RawUI.WindowSize.Width
|
||||
$standardOut = @(&$omp prompt print primary --exit="$errorCode" --pwd="$cleanPWD" --pswd="$cleanPSWD" --timing="$executionTime" --stack-count="$stackCount" --config="$config" --terminal-width=$terminalWidth 2>&1)
|
||||
$standardOut = @(&$omp prompt print primary --error="$errorCode" --pwd="$cleanPWD" --pswd="$cleanPSWD" --execution-time="$executionTime" --stack-count="$stackCount" --config="$config" --terminal-width=$terminalWidth 2>&1)
|
||||
# make sure PSReadLine knows we have a multiline prompt
|
||||
$extraLines = $standardOut.Count - 1
|
||||
if ($extraLines -gt 0) {
|
||||
|
@ -112,7 +112,7 @@ Set-Item -Path Function:prompt -Value $Prompt -Force
|
|||
function global:Write-PoshDebug {
|
||||
$omp = "::OMP::"
|
||||
$config, $cleanPWD, $cleanPSWD = Get-PoshContext
|
||||
$standardOut = @(&$omp prompt print debug --exit=1337 --pwd="$cleanPWD" --pswd="$cleanPSWD" --timing=9001 --config="$config" 2>&1)
|
||||
$standardOut = @(&$omp prompt print debug --error=1337 --pwd="$cleanPWD" --pswd="$cleanPSWD" --execution-time=9001 --config="$config" 2>&1)
|
||||
$standardOut -join "`n"
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ function prompt_ohmyposh_precmd() {
|
|||
omp_now=$(::OMP:: config get millis)
|
||||
omp_elapsed=$(($omp_now-$omp_start_time))
|
||||
fi
|
||||
eval "$(::OMP:: prompt print primary --config="$POSH_THEME" --exit="$omp_last_error" --timing="$omp_elapsed" --stack-count="$omp_stack_count" --eval --shell=zsh)"
|
||||
eval "$(::OMP:: prompt print primary --config="$POSH_THEME" --error="$omp_last_error" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" --eval --shell=zsh)"
|
||||
unset omp_start_time
|
||||
unset omp_now
|
||||
unset omp_elapsed
|
||||
|
|
Loading…
Reference in a new issue