From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp40.i.mail.ru (smtp40.i.mail.ru [94.100.177.100]) (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 AA4854696C3 for ; Thu, 2 Apr 2020 18:50:39 +0300 (MSK) Received: by smtp40.i.mail.ru with esmtpa (envelope-from ) id 1jK275-0004hG-55 for tarantool-patches@dev.tarantool.org; Thu, 02 Apr 2020 18:50:39 +0300 From: lvasiliev References: <20200331232104.GP22874@tarantool.org> Message-ID: <7b3000e8-a389-6b66-66f6-aa4d3bc8ef24@tarantool.org> Date: Thu, 2 Apr 2020 18:50:38 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH v2 1/2] luarocks: Add a kludge for option all of luarocks search List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org @Changelog Fixed the tarantoolctl rocks search flag --all (https://github.com/tarantool/tarantool/issues/4529) On 01.04.2020 13:00, lvasiliev wrote: > Hi, thanks for the review. You're darn right! > > diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in > index 2b95e29..b26dd10 100755 > --- a/extra/dist/tarantoolctl.in > +++ b/extra/dist/tarantoolctl.in > @@ -945,7 +945,7 @@ local function rocks() >      end >      table.insert(positional_arguments, key) > > -    if positional_arguments[1] == "search" and find_arg("all") then > +    if positional_arguments[1] == "search" and keyword_arguments["all"] > then >          table.insert(positional_arguments, "--all") >      end > > On 01.04.2020 2:21, Igor Munkin wrote: >> Leonid, >> >> Thanks for the patch! Please consider the comment below. >> >> On 16.03.20, Leonid Vasiliev wrote: >>> From: Leonid >>> >>> Fixed the tarantoolctl rocks search flag --all >>> >>> Forwarding of the --all flag to tarantoolctl rocks module was added. >>> (Command: tarantoolctl rocks search --all) >>> >>> Fixes: #4529 >>> --- >>>   extra/dist/tarantoolctl.in | 6 ++++++ >>>   1 file changed, 6 insertions(+) >>> >>> diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in >>> index 6daf866ac..372838edd 100755 >>> --- a/extra/dist/tarantoolctl.in >>> +++ b/extra/dist/tarantoolctl.in >> >> >> >>> @@ -945,6 +946,10 @@ local function rocks() >>>       end >>>       table.insert(positional_arguments, key) >>> +    if positional_arguments[1] == "search" and find_arg("all") then >> >> This is a bad check. Consider the following example: >> | $ export LUA_PATH="$LUA_PATH;third_party/luarocks/src/?.lua;;" >> | $ ./extra/dist/tarantoolctl rocks search --all > valid.out >> | $ wc valid.out && echo "Non-empty output" >> | 17835  56986 605906 valid.out >> | Non-empty output >> | $ ./extra/dist/tarantoolctl rocks search all --force > invalid.out >> | $ diff -u valid.out invalid.out && echo "Outputs are the same" >> | Outputs are the same >> >> You need to check whether 'all' key exists in keyword_arguments, not to >> search 'all' substring in arg tables values. >> >>> +        table.insert(positional_arguments, "--all") >>> +    end >>> + >>>       -- Tweak help messages >>>       util.see_help = function(command, program) >>>           -- TODO: print extended help message here >> >> >> >>> -- >>> 2.17.1 >>> >>