mirror of
https://github.com/cmderdev/cmder.git
synced 2025-03-12 21:54:38 +08:00
set global cmderGitStatusOptIn var for use in clink-completions
This commit is contained in:
parent
c34eb73555
commit
6027ac31c4
23
vendor/clink.lua
vendored
23
vendor/clink.lua
vendored
@ -285,15 +285,24 @@ end
|
|||||||
-- @return {bool}
|
-- @return {bool}
|
||||||
---
|
---
|
||||||
local function get_git_status_setting()
|
local function get_git_status_setting()
|
||||||
gitStatusSetting = io.popen("git --no-pager config -l 2>nul")
|
local gitStatusConfig = io.popen("git --no-pager config cmder.status 2>nul")
|
||||||
|
|
||||||
for line in gitStatusSetting:lines() do
|
for line in gitStatusConfig:lines() do
|
||||||
if string.match(line, 'cmder.status=false') or string.match(line, 'cmder.cmdstatus=false') then
|
if string.match(line, 'false') then
|
||||||
gitStatusSetting:close()
|
gitStatusConfig:close()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
gitStatusSetting:close()
|
|
||||||
|
local gitCmdStatusConfig = io.popen("git --no-pager config cmder.cmdstatus 2>nul")
|
||||||
|
for line in gitCmdStatusConfig:lines() do
|
||||||
|
if string.match(line, 'false') then
|
||||||
|
gitCmdStatusConfig:close()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
gitStatusConfig:close()
|
||||||
|
gitCmdStatusConfig:close()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -308,8 +317,8 @@ local function git_prompt_filter()
|
|||||||
}
|
}
|
||||||
|
|
||||||
local git_dir = get_git_dir()
|
local git_dir = get_git_dir()
|
||||||
|
cmderGitStatusOptIn = get_git_status_setting()
|
||||||
if get_git_status_setting() then
|
if cmderGitStatusOptIn then
|
||||||
if git_dir then
|
if git_dir then
|
||||||
-- if we're inside of git repo then try to detect current branch
|
-- if we're inside of git repo then try to detect current branch
|
||||||
local branch = get_git_branch(git_dir)
|
local branch = get_git_branch(git_dir)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user