Skip to content

Commit

Permalink
fix(get): add shell
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Sep 23, 2022
1 parent 0699b14 commit babe425
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/cli/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/shell/scripts/omp.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/shell/scripts/omp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/shell/scripts/omp.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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")"
Expand Down

0 comments on commit babe425

Please sign in to comment.