-
Notifications
You must be signed in to change notification settings - Fork 12
/
module.lua_template
46 lines (35 loc) · 1.78 KB
/
module.lua_template
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
-- REMOVE IF ADDED TO CORE APPLICATION
repeat
-- add proper user dylib path if it doesn't already exist
if not package.cpath:match(hs.configdir .. "/%?.dylib") then
package.cpath = hs.configdir .. "/?.dylib;" .. package.cpath
end
-- load docs file if provided
local basePath, moduleName = debug.getinfo(1, "S").source:match("^@(.*)/([%w_]+).lua$")
if basePath and moduleName then
if moduleName == "init" then
moduleName = moduleName:match("/([%w_]+)$")
end
local docsFileName = basePath .. "/" .. moduleName .. ".docs.json"
if require"hs.fs".attributes(docsFileName) then
require"hs.doc".registerJSONFile(docsFileName)
end
end
-- setup loaders for submodules (if any)
-- copy into Hammerspoon/setup.lua before removing
until true -- executes once and hides any local variables we create
-- END REMOVE IF ADDED TO CORE APPLICATION
--- === hs._asm.module ===
---
--- Stuff about the module
local USERDATA_TAG = "hs._asm.module"
local module = require(table.concat({ USERDATA_TAG:match("^([%w%._]+%.)([%w_]+)$") }, "lib"))
-- settings with periods in them can't be watched via KVO with hs.settings.watchKey, so
-- in general it's a good idea not to include periods
-- local SETTINGS_TAG = USERDATA_TAG:gsub("%.", "_")
-- local settings = require("hs.settings")
-- local log = require("hs.logger").new(USERDATA_TAG, settings.get(SETTINGS_TAG .. "_logLevel") or "warning")
-- private variables and methods -----------------------------------------
-- Public interface ------------------------------------------------------
-- Return Module Object --------------------------------------------------
return module