don't export splitQuotedString

This commit is contained in:
Daniel Poelzleithner 2022-06-03 02:47:23 +02:00
parent f2272f1aa7
commit 5b8fa2deda
3 changed files with 17 additions and 8 deletions

View File

@ -1,5 +1,8 @@
2018-03-09: 2.4.0
enhancement: add nix flake support
2021-03-09: 2.3.0
add: nix flake support
add: support for tunnel commands
add: support for batchSizeLimit
add: -onepass option
change: support relative executable paths
2018-03-09: 2.2.3

View File

@ -4616,7 +4616,7 @@ local function splitPath
end
end
function splitQuotedString
local function splitQuotedString
(
text
)
@ -4645,6 +4645,8 @@ function splitQuotedString
return rv
end
lsyncd.splitQuotedString = splitQuotedString
function substitudeCommands(cmd, data)
assert(type(data) == "table")
local getData = function(arg)

View File

@ -5,7 +5,7 @@ cwriteln( ' Testing Utils Functions ' )
cwriteln( '****************************************************************' )
assert(isTableEqual(
splitQuotedString("-p 22 -i '/home/test/bla blu/id_rsa'"),
lsyncd.splitQuotedString("-p 22 -i '/home/test/bla blu/id_rsa'"),
{"-p", "22", "-i", "/home/test/bla blu/id_rsa"}
))
@ -14,14 +14,18 @@ local testData = {
localPort = 1234,
localHost = "localhorst"
}
assert(substitudeCommands("echo ssh ${localHost}:${localPort}", testData) ==
"echo ssh localhorst:1234")
assert(isTableEqual(
substitudeCommands({"-p${doesNotExist}", "2${localHost}2", "-i '${localPort}'"}, testData),
{"-p", "2localhorst2", "-i '1234'"}
substitudeCommands({"-p^doesNotExist", "2^localHostA", "-i '^localPort'"}, testData),
{"-p^doesNotExist", "2localhorstA", "-i '1234'"}
))
assert(
substitudeCommands("-p^doesNotExist 2^localHostA -i '^localPort'", testData),
"-p^doesNotExist 2localhorstA -i '1234'"
)
assert(type(lsyncd.get_free_port()) == "number")
os.exit(0)