# HG changeset patch # User João Duarte # Date 1564580533 25200 # Node ID 152604d54732cfd448afa8a6d2fae3ece4c8f8c7 # Parent 2364e9533d0e1c3023f0392b73e576335db872e5 util.prosodyctl: Added the check_flags function diff -r 2364e9533d0e -r 152604d54732 util/prosodyctl.lua --- a/util/prosodyctl.lua Wed Jul 31 05:55:32 2019 -0700 +++ b/util/prosodyctl.lua Wed Jul 31 06:42:13 2019 -0700 @@ -292,10 +292,20 @@ -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now -- luacheck: ignore 512 for path in plugin_paths:gmatch("[^;]+") do - return path + return path; end end +local function check_flags(arg) + local flag = "--tree="; + -- There might not be any argument when the list command is calling this function + if arg[1] and arg[1]:sub(1, #flag) == flag then + local dir = arg[1]:match("=(.+)$") + return true, arg[2], dir; + end + return false, arg[1] +end + return { show_message = show_message; show_warning = show_message; @@ -317,4 +327,5 @@ stop = stop; reload = reload; get_path_custom_plugins = get_path_custom_plugins; + check_flags = check_flags; };