diff --git a/changelogs/unreleased/gh-6983-fix-command-in-help-messages.md b/changelogs/unreleased/gh-6983-fix-command-in-help-messages.md new file mode 100644 index 0000000000000000000000000000000000000000..28e5243720e84a5fcef04c227b51d1c25f87caa8 --- /dev/null +++ b/changelogs/unreleased/gh-6983-fix-command-in-help-messages.md @@ -0,0 +1,3 @@ +## bugfix/tarantoolctl + +* Fix missing `rocks` keyword in tarantoolctl rocks help messages. diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in index fc0885fbe5cb48633c9b49a1eb4651df58b21977..5ff25b9f5100b368672adf550aa88697f9445eba 100755 --- a/extra/dist/tarantoolctl.in +++ b/extra/dist/tarantoolctl.in @@ -25,6 +25,8 @@ int getppid(void); local TIMEOUT_INFINITY = 100 * 365 * 86400 +-- path of tarantoolctl binary +local command_path = arg[0] -- name of tarantoolctl binary local self_name = fio.basename(arg[0]) -- command that we're executing @@ -946,6 +948,9 @@ local function rocks() -- TODO: print extended help message here return "See Tarantool documentation for help." end + util.this_program = function(default) -- luacheck: no unused args + return command_path .. " rocks" + end -- Disabled: path, upload local rocks_commands = { diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua index 9e129218820c0f0c8fc0cba5c04637546c4e20fb..e5171a501fb896305a13e2dce5f55ea6b38b7101 100755 --- a/test/app-tap/tarantoolctl.test.lua +++ b/test/app-tap/tarantoolctl.test.lua @@ -11,6 +11,7 @@ local ok, test_run = pcall(require, 'test_run') test_run = ok and test_run.new() or nil local BUILDDIR = os.getenv('BUILDDIR') or '.' +local SOURCEDIR = os.getenv("SOURCEDIR") or '.' local TARANTOOLCTL_PATH = ('%s/extra/dist/tarantoolctl'):format(BUILDDIR) local function recursive_rmdir(path) @@ -111,10 +112,11 @@ local function tctl_wait_stop(dir, name) end local function tctl_command(dir, cmd, args) + local rocks_path = SOURCEDIR .. '/third_party/luarocks/src/?.lua;;' if not fio.stat(fio.pathjoin(dir, '.tarantoolctl')) then create_script(dir, '.tarantoolctl', tctlcfg_code) end - local command = ('tarantoolctl %s %s'):format(cmd, args) + local command = ('LUA_PATH="' .. rocks_path .. '" tarantoolctl %s %s'):format(cmd, args) return run_command(dir, command) end @@ -327,11 +329,14 @@ do local status, err = pcall(function() test:test("check basic help", function(test_i) - test_i:plan(4) + local exp = 'tarantoolctl rocks %- ' .. + 'LuaRocks main command%-line interface' + test_i:plan(6) test_help(test_i, nil, "tarantoolctl", "Usage:") test_help(test_i, nil, "tarantoolctl help", "Usage:") test_help(test_i, nil, "tarantoolctl --help", "Usage:") test_help(test_i, dir, "tarantoolctl", "Usage:") + check_ok(test_i, dir, "rocks", "--help", 0, exp) end) end)