Skip to content

Commit aebd26d

Browse files
committed
[lib/dtutils.lua] - Added deprecated function to use when deprecating
scripts [contrib/rename-tags.lua] - Added deprecation warning
1 parent d609823 commit aebd26d

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

contrib/rename-tags.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ local debug = require "darktable.debug"
3434

3535
-- check API version
3636
du.check_min_api_version("7.0.0", "rename-tags")
37+
du.deprecated("contrib/rename-tags.lua","darktable release 4.0")
3738

3839
-- return data structure for script_manager
3940

lib/dtutils.lua

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,29 @@ function dtutils.find_image_by_id(imgid)
330330
end
331331
end
332332

333+
dtutils.libdoc.functions["deprecated"] = {
334+
Name = [[deprecated]],
335+
Synopsis = [[print deprecation warning]],
336+
Usage = [[local du = require "lib/dtutils"
337+
338+
du.deprecated(script_name, removal_string)
339+
script_name - name of the script being deprecated
340+
removal_strubg - a string explaining when the script will be removed]],
341+
Description = [[deprecated prints an error message saying the script is deprecated and when it will be removed]],
342+
Return_Value = [[]],
343+
Limitations = [[]],
344+
Example = [[local du = require "lib/dtutils"
345+
du.deprecated("contrib/rename-tags.lua", "darktable release 4.0")]],
346+
See_Also = [[]],
347+
Reference = [[]],
348+
License = [[]],
349+
Copyright = [[]],
350+
}
351+
352+
function dtutils.deprecated(script_name, removal_string)
353+
dt.print_toast("WARNING: " .. script_name .. " is deprecated and will be removed in " .. removal_string)
354+
dt.print_error("WARNING: " .. script_name .. " is deprecated and will be removed in " .. removal_string)
355+
end
356+
357+
333358
return dtutils

0 commit comments

Comments
 (0)