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 2021-03-09: 2.3.0
enhancement: add nix flake support add: nix flake support
add: support for tunnel commands
add: support for batchSizeLimit
add: -onepass option
change: support relative executable paths change: support relative executable paths
2018-03-09: 2.2.3 2018-03-09: 2.2.3

View File

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

View File

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