From: Leonid Vasiliev <lvasiliev@tarantool.org>
To: v.shpilevoy@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v2 2/3] Add a black list for tarantoolctl rocks options
Date: Sun, 5 Apr 2020 17:50:08 +0300 [thread overview]
Message-ID: <9e733ecbf524aeeb4c417451e11e87b5986660c8.1586096636.git.lvasiliev@tarantool.org> (raw)
In-Reply-To: <cover.1586096636.git.lvasiliev@tarantool.org>
In-Reply-To: <cover.1586096636.git.lvasiliev@tarantool.org>
---
src/luarocks/cmd/help.lua | 5 -----
src/luarocks/util.lua | 14 ++++++++++++++
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/luarocks/cmd/help.lua b/src/luarocks/cmd/help.lua
index dcc9e35..202fe43 100644
--- a/src/luarocks/cmd/help.lua
+++ b/src/luarocks/cmd/help.lua
@@ -62,12 +62,7 @@ function help.command(description, commands, command)
(overrides any entries in the config file)
--only-sources=<url> Restrict downloads to paths matching the
given URL.
- --lua-dir=<prefix> Which Lua installation to use.
- --lua-version=<ver> Which Lua version to use.
--tree=<tree> Which tree to operate on.
- --local Use the tree in the user's home directory.
- To enable it, see ']]..program..[[ help path'.
- --global Use the system tree when `local_by_default` is `true`.
--verbose Display verbose output of commands executed.
--timeout=<seconds> Timeout on network operations, in seconds.
0 means no timeout (wait forever).
diff --git a/src/luarocks/util.lua b/src/luarocks/util.lua
index 8ccda27..895747c 100644
--- a/src/luarocks/util.lua
+++ b/src/luarocks/util.lua
@@ -171,6 +171,14 @@ local supported_flags = {
["version"] = true,
}
+-- The tarantool unsupported arguments list.
+local tarantool_black_list = {
+ ["global"] = true,
+ ["local"] = true,
+ ["lua-version"] = true,
+ ["lua-dir"] = true,
+}
+
--- Extract flags from an arguments list.
-- Given string arguments, extract flag arguments into a flags set.
-- For example, given "foo", "--tux=beep", "--bla", "bar", "--baz",
@@ -189,6 +197,9 @@ function util.parse_flags(...)
elseif state == "initial" and flag then
local var,val = flag:match("([a-z_%-]*)=(.*)")
if val then
+ if tarantool_black_list[var] then
+ return { ERROR = "Invalid argument: flag --"..var.." is not supported by tarantoolctl rocks." }
+ end
local vartype = supported_flags[var]
if type(vartype) == "string" then
if val == "" and vartype:sub(1,1) ~= '"' then
@@ -204,6 +215,9 @@ function util.parse_flags(...)
end
else
local var = flag
+ if tarantool_black_list[var] then
+ return { ERROR = "Invalid argument: flag --"..var.." is not supported by tarantoolctl rocks." }
+ end
local vartype = supported_flags[var]
if type(vartype) == "string" then
i = i + 1
--
2.7.4
next prev parent reply other threads:[~2020-04-05 14:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-05 14:50 [Tarantool-patches] [PATCH v2 0/3] Adapt luarocks for tarantoolctl Leonid Vasiliev
2020-04-05 14:50 ` [Tarantool-patches] [PATCH v2 1/3] Add the chdir option for make Leonid Vasiliev
2020-04-05 18:40 ` Vladislav Shpilevoy
2020-04-05 14:50 ` Leonid Vasiliev [this message]
2020-04-05 14:50 ` [Tarantool-patches] [PATCH v2 3/3] Adapt luarocks help for tarantoolctl rocks Leonid Vasiliev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9e733ecbf524aeeb4c417451e11e87b5986660c8.1586096636.git.lvasiliev@tarantool.org \
--to=lvasiliev@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v2 2/3] Add a black list for tarantoolctl rocks options' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox