mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-02-02 05:41:10 -08:00
fix(cmd): allow all types of path separators
This commit is contained in:
parent
79c5ad845f
commit
2c1d5cf6e4
|
@ -4,6 +4,14 @@ local endedit_time
|
||||||
local last_duration
|
local last_duration
|
||||||
local tip_word
|
local tip_word
|
||||||
|
|
||||||
|
local function omp_exe()
|
||||||
|
return [[::OMP::]]
|
||||||
|
end
|
||||||
|
|
||||||
|
local function omp_config()
|
||||||
|
return [[::CONFIG::]]
|
||||||
|
end
|
||||||
|
|
||||||
local function os_clock_millis()
|
local function os_clock_millis()
|
||||||
-- Clink v1.2.30 has a fix for Lua's os.clock() implementation failing after
|
-- Clink v1.2.30 has a fix for Lua's os.clock() implementation failing after
|
||||||
-- the program has been running more than 24 days. In older versions, call
|
-- the program has been running more than 24 days. In older versions, call
|
||||||
|
@ -11,7 +19,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
|
||||||
return io.popen("::OMP:: --millis"):read("*n")
|
return io.popen(omp_exe().." --millis"):read("*n")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -47,7 +55,7 @@ local function error_level_option()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_posh_prompt(rprompt)
|
local function get_posh_prompt(rprompt)
|
||||||
local prompt_exe = string.format('::OMP:: --shell=cmd --config="::CONFIG::" %s %s --rprompt=%s', execution_time_option(), error_level_option(), rprompt)
|
local prompt_exe = string.format('%s --shell=cmd --config="%s" %s %s --rprompt=%s', omp_exe(), omp_config(), execution_time_option(), error_level_option(), rprompt)
|
||||||
prompt = io.popen(prompt_exe):read("*a")
|
prompt = io.popen(prompt_exe):read("*a")
|
||||||
return prompt
|
return prompt
|
||||||
end
|
end
|
||||||
|
@ -60,7 +68,7 @@ function p:rightfilter(prompt)
|
||||||
if tip_word == nil then
|
if tip_word == nil then
|
||||||
return get_posh_prompt(true), false
|
return get_posh_prompt(true), false
|
||||||
end
|
end
|
||||||
local prompt_exe = string.format('::OMP:: --shell=cmd --config="::CONFIG::" --command="%s"', tip_word)
|
local prompt_exe = string.format('%s --shell=cmd --config="%s" --command="%s"', omp_exe(), omp_config(), tip_word)
|
||||||
tooltip = io.popen(prompt_exe):read("*a")
|
tooltip = io.popen(prompt_exe):read("*a")
|
||||||
if tooltip ~= "" then
|
if tooltip ~= "" then
|
||||||
return tooltip, false
|
return tooltip, false
|
||||||
|
@ -68,7 +76,8 @@ function p:rightfilter(prompt)
|
||||||
return get_posh_prompt(true), false
|
return get_posh_prompt(true), false
|
||||||
end
|
end
|
||||||
function p:transientfilter(prompt)
|
function p:transientfilter(prompt)
|
||||||
prompt = io.popen('::OMP:: --shell=cmd --config="::CONFIG::" --print-transient'):read("*a")
|
local prompt_exe = string.format('%s --shell=cmd --config="%s" --print-transient', omp_exe(), omp_config())
|
||||||
|
prompt = io.popen(prompt_exe):read("*a")
|
||||||
if prompt == "" then
|
if prompt == "" then
|
||||||
prompt = nil
|
prompt = nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue