From ae0ea5dee527e161142eb889312fe7bf4558c88a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 11 Dec 2018 19:47:45 +0000 Subject: [PATCH] [Minor] Selectors: Add inverse processor --- lualib/lua_selectors.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lualib/lua_selectors.lua b/lualib/lua_selectors.lua index 4025ef680..ab2692eac 100644 --- a/lualib/lua_selectors.lua +++ b/lualib/lua_selectors.lua @@ -524,6 +524,22 @@ Returns either nil or its input if input is in args list]], Returns either nil or its input if input is not in args list]], ['args_schema'] = ts.array_of(ts.string) }, + ['inverse'] = { + ['types'] = { + ['string'] = true, + }, + ['map_type'] = 'string', + ['process'] = function(inp, _, args) + if inp then + return nil + else + return (args[1] or 'true'),'string' + end + end, + ['description'] = [[Inverses input. +Empty string comes the first argument or 'true', non-empty string comes nil]], + ['args_schema'] = {ts.string:is_optional()} + }, } local function process_selector(task, sel) -- 2.39.5