forked from darktable-org/lua-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinclude_all.lua
61 lines (47 loc) · 1.95 KB
/
include_all.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--[[
This file is part of darktable,
copyright (c) 2014 Jérémy Rosen
copyright (c) 2018 Bill Ferguson
darktable is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
darktable is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with darktable. If not, see <http://www.gnu.org/licenses/>.
]]
--[[
INCLUDE ALL
Automatically include all scripts in the script repository
This is intended for debugging purpose
USAGE
* require this file from your main lua config file:
* go to configuration => preferences
* Enable the scripts you want to use
* restart darktable
Note that you need to restart DT for your changes to enabled scripts to take effect
]]
local dt = require "darktable"
local io = require "io"
-- must be loaded for scripts using darktable.control_execute to work
require "official/yield"
dt.configuration.check_version(...,{3,0,0},{4,0,0},{5,0,0})
-- find all scripts, but skip the lib and tools directories
local output = io.popen("cd "..dt.configuration.config_dir.."/lua ;find . -name lib -prune -o -name tools -prune -o -name \\*.lua -print")
local my_name={...}
my_name = my_name[1]
for line in output:lines() do
local req_name = line:sub(3,-5)
if req_name ~= my_name and not string.match(req_name, "yield") then
dt.preferences.register(my_name,req_name,"bool","enable "..req_name,
"Should the script "..req_name.." be enabled at next startup",false)
if dt.preferences.read(my_name,req_name,"bool") then
require(req_name)
end
end
end
--
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua