From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 50D9A440F3C for ; Mon, 18 Nov 2019 20:56:23 +0300 (MSK) From: Leonid Date: Mon, 18 Nov 2019 20:56:14 +0300 Message-Id: <5b343b354ccfab10598090aefb02dc294eb60c2c.1574098671.git.lvasiliev@tarantool.org> In-Reply-To: References: In-Reply-To: References: Subject: [Tarantool-patches] [PATCH LUAROCKS 2/2] Add the tarantool options black list. Align the help with functionality List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: alexander.turenko@tarantool.org Cc: tarantool-patches@dev.tarantool.org --- src/luarocks/cmd/help.lua | 15 +++++++++------ src/luarocks/util.lua | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/luarocks/cmd/help.lua b/src/luarocks/cmd/help.lua index dcc9e35..1db914a 100644 --- a/src/luarocks/cmd/help.lua +++ b/src/luarocks/cmd/help.lua @@ -12,6 +12,10 @@ local dir = require("luarocks.dir") local program = util.this_program("luarocks") +if program:find("tarantoolctl") then + program = program.." rocks" +end + help.help_summary = "Help on commands. Type '"..program.." help ' for more." help.help_arguments = "[]" @@ -20,7 +24,11 @@ help.help = [[ ]] local function print_banner() - util.printout("\nLuaRocks "..cfg.program_version..", the Lua package manager") + if program:find("tarantoolctl") then + util.printout("\nTarantoolctl rocks, the Lua package manager based on LuaRocks "..cfg.program_version) + else + util.printout("\nLuaRocks "..cfg.program_version..", the Lua package manager") + end end local function print_section(section) @@ -62,12 +70,7 @@ function help.command(description, commands, command) (overrides any entries in the config file) --only-sources= Restrict downloads to paths matching the given URL. - --lua-dir= Which Lua installation to use. - --lua-version= Which Lua version to use. --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= 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 fadc93f..660d140 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.." does not supported by tarantoolctl roks." } + 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.." does not supported by tarantoolctl roks." } + end local vartype = supported_flags[var] if type(vartype) == "string" then i = i + 1 -- 2.17.1