commit b228d05bc2bd81c75652966b4fe887ce723c66e9 parent e48f3bdf20cad0b766bffd8714c19df13dfa0d76 Author: Tomas Nemec <nemi@skaut.cz> Date: Mon, 9 Aug 2021 09:18:43 +0200 refactor(trun) Diffstat:
M | trun.lua | | | 17 | +++++++++-------- |
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/trun.lua b/trun.lua @@ -34,11 +34,12 @@ -- -- # Config -- There are 2 ENV VAR you may want to set: --- - TRUN_HANDLERS_DIR: directory where handlers are stored (default to XDG_CONFIG_HOME/trun) -local handlers_dir = os.getenv('TRUN_HANDLERS_DIR') or os.getenv('XDG_CONFIG_HOME') .. '/trun' --- - TRUN_STATUS_DIR: directory to store files with statuses (default to XDG_CACHE_HOME/trun) -local status_dir = os.getenv('TRUN_STATUS_DIR') or os.getenv('XDG_CACHE_HOME') .. '/trun' --- +-- - TRUN_HANDLERS_DIR: directory where handlers are stored +local handlers_dir_def = os.getenv('XDG_CONFIG_HOME') .. '/trun' +local handlers_dir = os.getenv('TRUN_HANDLERS_DIR') or handlers_dir_def +-- - TRUN_STATUS_DIR: directory to store files with statuses +local status_dir_def = os.getenv('XDG_CACHE_HOME') .. '/trun' +local status_dir = os.getenv('TRUN_STATUS_DIR') or status_dir_def local handler_name = arg[1] if not handler_name then @@ -77,9 +78,9 @@ local function cleanup() end end ------------------------------------------------------------------------------------------------------------------------ +------------------------------------------------------------------------------ -- handling signals ------------------------------------------------------------------------------------------------------------------------ +------------------------------------------------------------------------------ local function on_exit(signum) cleanup() @@ -96,7 +97,7 @@ else io.write('For signal handle install luaposix (`luarocks install luaposix`).\n') end ------------------------------------------------------------------------------------------------------------------------ +------------------------------------------------------------------------------ local status