mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-14 07:29:12 +08:00
Clean luacheck warnings.
This commit is contained in:
parent
5fab87f4d6
commit
a605ec520d
21
vendor/clink.lua
vendored
21
vendor/clink.lua
vendored
@ -3,7 +3,12 @@
|
|||||||
-- !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
|
-- !!! THIS FILE IS OVERWRITTEN WHEN CMDER IS UPDATED
|
||||||
-- !!! Use "%CMDER_ROOT%\config\<whatever>.lua" to add your lua startup scripts
|
-- !!! Use "%CMDER_ROOT%\config\<whatever>.lua" to add your lua startup scripts
|
||||||
|
|
||||||
-- luacheck: globals clink
|
-- luacheck: globals CMDER_SESSION
|
||||||
|
-- luacheck: globals uah_color cwd_color lamb_color clean_color dirty_color conflict_color unknown_color
|
||||||
|
-- luacheck: globals prompt_homeSymbol prompt_lambSymbol prompt_type prompt_useHomeSymbol prompt_useUserAtHost
|
||||||
|
-- luacheck: globals prompt_singleLine prompt_includeVersionControl
|
||||||
|
-- luacheck: globals prompt_overrideGitStatusOptIn prompt_overrideSvnStatusOptIn
|
||||||
|
-- luacheck: globals clink io.popenyield os.isdir settings.get
|
||||||
|
|
||||||
-- At first, load the original clink.lua file
|
-- At first, load the original clink.lua file
|
||||||
-- this is needed as we set the script path to this dir and therefore the original
|
-- this is needed as we set the script path to this dir and therefore the original
|
||||||
@ -191,7 +196,7 @@ end
|
|||||||
local function get_dir_contains(path, dirname)
|
local function get_dir_contains(path, dirname)
|
||||||
|
|
||||||
-- return parent path for specified entry (either file or directory)
|
-- return parent path for specified entry (either file or directory)
|
||||||
local function pathname(path)
|
local function pathname(path) -- luacheck: ignore 432
|
||||||
local prefix = ""
|
local prefix = ""
|
||||||
local i = path:find("[\\/:][^\\/:]*$")
|
local i = path:find("[\\/:][^\\/:]*$")
|
||||||
if i then
|
if i then
|
||||||
@ -201,14 +206,14 @@ local function get_dir_contains(path, dirname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Navigates up one level
|
-- Navigates up one level
|
||||||
local function up_one_level(path)
|
local function up_one_level(path) -- luacheck: ignore 432
|
||||||
if path == nil then path = '.' end
|
if path == nil then path = '.' end
|
||||||
if path == '.' then path = clink.get_cwd() end
|
if path == '.' then path = clink.get_cwd() end
|
||||||
return pathname(path)
|
return pathname(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Checks if provided directory contains git directory
|
-- Checks if provided directory contains git directory
|
||||||
local function has_specified_dir(path, specified_dir)
|
local function has_specified_dir(path, specified_dir) -- luacheck: ignore 432
|
||||||
if path == nil then path = '.' end
|
if path == nil then path = '.' end
|
||||||
local found_dirs = clink.find_dirs(path..'/'..specified_dir)
|
local found_dirs = clink.find_dirs(path..'/'..specified_dir)
|
||||||
if #found_dirs > 0 then return true end
|
if #found_dirs > 0 then return true end
|
||||||
@ -236,7 +241,7 @@ end
|
|||||||
local function get_git_dir(path)
|
local function get_git_dir(path)
|
||||||
|
|
||||||
-- return parent path for specified entry (either file or directory)
|
-- return parent path for specified entry (either file or directory)
|
||||||
local function pathname(path)
|
local function pathname(path) -- luacheck: ignore 432
|
||||||
local prefix = ""
|
local prefix = ""
|
||||||
local i = path:find("[\\/:][^\\/:]*$")
|
local i = path:find("[\\/:][^\\/:]*$")
|
||||||
if i then
|
if i then
|
||||||
@ -346,7 +351,7 @@ end
|
|||||||
-- Find out current branch
|
-- Find out current branch
|
||||||
-- @return {false|svn branch name}
|
-- @return {false|svn branch name}
|
||||||
---
|
---
|
||||||
local function get_svn_branch(svn_dir)
|
local function get_svn_branch()
|
||||||
local file = io_popenyield("svn info 2>nul")
|
local file = io_popenyield("svn info 2>nul")
|
||||||
if not file then
|
if not file then
|
||||||
return false
|
return false
|
||||||
@ -379,7 +384,7 @@ local function get_git_status()
|
|||||||
for line in file:lines() do
|
for line in file:lines() do
|
||||||
local code = line:sub(1, 2)
|
local code = line:sub(1, 2)
|
||||||
-- print (string.format("code: %s, line: %s", code, line))
|
-- print (string.format("code: %s, line: %s", code, line))
|
||||||
if code == "DD" or code == "AU" or code == "UD" or code == "UA" or code == "DU" or code == "AA" or code == "UU" then
|
if code == "DD" or code == "AU" or code == "UD" or code == "UA" or code == "DU" or code == "AA" or code == "UU" then -- luacheck: no max line length
|
||||||
is_status = false
|
is_status = false
|
||||||
conflict_found = true
|
conflict_found = true
|
||||||
break
|
break
|
||||||
@ -608,7 +613,7 @@ local function svn_prompt_filter()
|
|||||||
end
|
end
|
||||||
-- Get the svn status using coroutine if available and option is enabled. Otherwise use a blocking call
|
-- Get the svn status using coroutine if available and option is enabled. Otherwise use a blocking call
|
||||||
local svnStatus
|
local svnStatus
|
||||||
if clink.promptcoroutine and io.popenyield and settings.get("prompt.async") and prompt_overrideSvnStatusOptIn then
|
if clink.promptcoroutine and io.popenyield and settings.get("prompt.async") and prompt_overrideSvnStatusOptIn then -- luacheck: no max line length
|
||||||
svnStatus = clink_promptcoroutine(function ()
|
svnStatus = clink_promptcoroutine(function ()
|
||||||
return get_svn_status()
|
return get_svn_status()
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user