mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix: fish 3.2 empty command duration
This commit is contained in:
parent
838567cbcd
commit
494d3b2d20
|
@ -1,11 +1,22 @@
|
||||||
function fish_prompt
|
function fish_prompt
|
||||||
set -l omp_duration "$CMD_DURATION$cmd_duration"
|
set -l omp_duration "$CMD_DURATION$cmd_duration"
|
||||||
if test "$omp_lastcommand" = ""
|
# check if variable set, < 3.2 case
|
||||||
set omp_duration 0
|
if set -q omp_lastcommand; and test "$omp_lastcommand" = ""
|
||||||
|
set omp_duration 0
|
||||||
end
|
end
|
||||||
|
# works with fish >=3.2
|
||||||
|
if set -q omp_last_status_generation; and test "$omp_last_status_generation" = "$status_generation"
|
||||||
|
set omp_duration 0
|
||||||
|
end
|
||||||
|
if set -q status_generation
|
||||||
|
set -gx omp_last_status_generation $status_generation
|
||||||
|
end
|
||||||
|
|
||||||
::OMP:: --config ::CONFIG:: --error $status --execution-time $omp_duration
|
::OMP:: --config ::CONFIG:: --error $status --execution-time $omp_duration
|
||||||
end
|
end
|
||||||
|
|
||||||
function postexec_omp --on-event fish_postexec
|
function postexec_omp --on-event fish_postexec
|
||||||
|
# works with fish <3.2
|
||||||
|
# pre and postexec not fired for empty command in fish >=3.2
|
||||||
set -gx omp_lastcommand $argv
|
set -gx omp_lastcommand $argv
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue