[tarantool-patches] [PATCH] tarantoolctl: Add new options for rocks

Ilya Markov imarkov at tarantool.org
Thu Jun 21 13:07:22 MSK 2018


Add propagation to luarocks of --only-server, --server keys.

Closes #2640
---
https://github.com/tarantool/tarantool/issues/2640
https://github.com/tarantool/tarantool/tree/gh-2640-tarantoolctl-support-only-server

 extra/dist/tarantoolctl.in | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in
index b6b8e09..3b96058 100755
--- a/extra/dist/tarantoolctl.in
+++ b/extra/dist/tarantoolctl.in
@@ -859,11 +859,28 @@ local function play()
     remote:close()
 end

+local function find_arg(name_arg)
+    for i, key in ipairs(arg) do
+        if key:find(name_arg) ~= nil then
+            return key
+        end
+    end
+    return nil
+end
+
 local function rocks()
     local cfg = require("luarocks.cfg")
     local util = require("luarocks.util")
     local loader = require("luarocks.loader")
     local command_line = require("luarocks.command_line")
+    local options = keyword_arguments
+    local key = nil
+    if options["only-server"] ~= nil then
+        key = find_arg("only%-server")
+    else
+        key = find_arg("server")
+    end
+    table.insert(positional_arguments, key)

     -- Tweak help messages
     util.see_help = function(command, program)
@@ -885,7 +902,6 @@ local function rocks()
     if keyword_arguments.chdir then
         ffi.C.chdir(keyword_arguments.chdir)
     end
-
     -- Call LuaRocks
     command_line.run_command(unpack(positional_arguments))
 end
@@ -1253,6 +1269,8 @@ do
         { 'format',      'string'  },
         { 'replica',     'number+' },
         { 'chdir',       'string'  },
+        { 'only-server', 'string'  },
+        { 'server',      'string'  },
     })

     local cmd_name
--
2.7.4





More information about the Tarantool-patches mailing list