fix(get): add shell

This commit is contained in:
Jan De Dobbeleer 2022-09-23 08:39:27 +02:00 committed by Jan De Dobbeleer
parent 0699b146c6
commit babe425f3f
4 changed files with 7 additions and 4 deletions

View file

@ -34,6 +34,9 @@ This command is used to get the value of the following variables:
} }
env := &environment.ShellEnvironment{ env := &environment.ShellEnvironment{
Version: cliVersion, Version: cliVersion,
CmdFlags: &environment.Flags{
Shell: shellName,
},
} }
env.Init() env.Init()
defer env.Close() defer env.Close()

View file

@ -17,7 +17,7 @@ function _omp_hook() {
local omp_stack_count=$((${#DIRSTACK[@]} - 1)) local omp_stack_count=$((${#DIRSTACK[@]} - 1))
local omp_elapsed=-1 local omp_elapsed=-1
if [[ -n "$omp_start_time" ]]; then 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_elapsed=$((omp_now-omp_start_time))
omp_start_time="" omp_start_time=""
fi fi

View file

@ -60,7 +60,7 @@ local function os_clock_millis()
if (clink.version_encoded or 0) >= 10020030 then if (clink.version_encoded or 0) >= 10020030 then
return math.floor(os.clock() * 1000) return math.floor(os.clock() * 1000)
else 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) return run_posh_command(prompt_exe)
end end
end end
@ -177,7 +177,7 @@ function p:rightfilter(prompt)
return cached_prompt.right, false return cached_prompt.right, false
end end
function p:transientfilter(prompt) 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) prompt = run_posh_command(prompt_exe)
if prompt == "" then if prompt == "" then
prompt = nil prompt = nil

View file

@ -14,7 +14,7 @@ function prompt_ohmyposh_precmd() {
omp_stack_count=${#dirstack[@]} omp_stack_count=${#dirstack[@]}
omp_elapsed=-1 omp_elapsed=-1
if [ $omp_start_time ]; then if [ $omp_start_time ]; then
omp_now=$(::OMP:: get millis) omp_now=$(::OMP:: get millis --shell=zsh)
omp_elapsed=$(($omp_now-$omp_start_time)) omp_elapsed=$(($omp_now-$omp_start_time))
fi 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")" 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")"