mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 04:19:41 -08:00
fix(get): add shell
This commit is contained in:
parent
0699b146c6
commit
babe425f3f
|
@ -34,6 +34,9 @@ This command is used to get the value of the following variables:
|
|||
}
|
||||
env := &environment.ShellEnvironment{
|
||||
Version: cliVersion,
|
||||
CmdFlags: &environment.Flags{
|
||||
Shell: shellName,
|
||||
},
|
||||
}
|
||||
env.Init()
|
||||
defer env.Close()
|
||||
|
|
|
@ -17,7 +17,7 @@ function _omp_hook() {
|
|||
local omp_stack_count=$((${#DIRSTACK[@]} - 1))
|
||||
local omp_elapsed=-1
|
||||
if [[ -n "$omp_start_time" ]]; then
|
||||
local omp_now=$(::OMP:: get millis)
|
||||
local omp_now=$(::OMP:: get millis --shell=bash)
|
||||
omp_elapsed=$((omp_now-omp_start_time))
|
||||
omp_start_time=""
|
||||
fi
|
||||
|
|
|
@ -60,7 +60,7 @@ local function os_clock_millis()
|
|||
if (clink.version_encoded or 0) >= 10020030 then
|
||||
return math.floor(os.clock() * 1000)
|
||||
else
|
||||
local prompt_exe = string.format('%s get millis', omp_exe())
|
||||
local prompt_exe = string.format('%s get millis --shell=cmd', omp_exe())
|
||||
return run_posh_command(prompt_exe)
|
||||
end
|
||||
end
|
||||
|
@ -177,7 +177,7 @@ function p:rightfilter(prompt)
|
|||
return cached_prompt.right, false
|
||||
end
|
||||
function p:transientfilter(prompt)
|
||||
local prompt_exe = string.format('%s print transient --config=%s %s', omp_exe(), omp_config(), error_level_option())
|
||||
local prompt_exe = string.format('%s print transient --shell=cmd --config=%s %s', omp_exe(), omp_config(), error_level_option())
|
||||
prompt = run_posh_command(prompt_exe)
|
||||
if prompt == "" then
|
||||
prompt = nil
|
||||
|
|
|
@ -14,7 +14,7 @@ function prompt_ohmyposh_precmd() {
|
|||
omp_stack_count=${#dirstack[@]}
|
||||
omp_elapsed=-1
|
||||
if [ $omp_start_time ]; then
|
||||
omp_now=$(::OMP:: get millis)
|
||||
omp_now=$(::OMP:: get millis --shell=zsh)
|
||||
omp_elapsed=$(($omp_now-$omp_start_time))
|
||||
fi
|
||||
eval "$(::OMP:: print primary --config="$POSH_THEME" --error="$omp_last_error" --execution-time="$omp_elapsed" --stack-count="$omp_stack_count" --eval --shell=zsh --shell-version="$ZSH_VERSION")"
|
||||
|
|
Loading…
Reference in a new issue