[lib/dtutils.lua] - Added deprecated function to use when deprecating

scripts

[contrib/rename-tags.lua] - Added deprecation warning
This commit is contained in:
Bill Ferguson
2021-12-27 19:36:15 -05:00
parent d609823491
commit aebd26d03a
2 changed files with 26 additions and 0 deletions

View File

@@ -34,6 +34,7 @@ local debug = require "darktable.debug"
-- check API version
du.check_min_api_version("7.0.0", "rename-tags")
du.deprecated("contrib/rename-tags.lua","darktable release 4.0")
-- return data structure for script_manager

View File

@@ -330,4 +330,29 @@ function dtutils.find_image_by_id(imgid)
end
end
dtutils.libdoc.functions["deprecated"] = {
Name = [[deprecated]],
Synopsis = [[print deprecation warning]],
Usage = [[local du = require "lib/dtutils"
du.deprecated(script_name, removal_string)
script_name - name of the script being deprecated
removal_strubg - a string explaining when the script will be removed]],
Description = [[deprecated prints an error message saying the script is deprecated and when it will be removed]],
Return_Value = [[]],
Limitations = [[]],
Example = [[local du = require "lib/dtutils"
du.deprecated("contrib/rename-tags.lua", "darktable release 4.0")]],
See_Also = [[]],
Reference = [[]],
License = [[]],
Copyright = [[]],
}
function dtutils.deprecated(script_name, removal_string)
dt.print_toast("WARNING: " .. script_name .. " is deprecated and will be removed in " .. removal_string)
dt.print_error("WARNING: " .. script_name .. " is deprecated and will be removed in " .. removal_string)
end
return dtutils