Add env module

This commit is contained in:
2018-04-24 11:35:11 +01:00
parent f509bdbd43
commit e30c612e59
2 changed files with 24 additions and 0 deletions

17
hammerspoon/env.lua Normal file
View File

@@ -0,0 +1,17 @@
local obj = {
hostname = nil
}
function obj:init()
self.hostname = self.getHostname()
end
function obj:getHostname()
local f = io.popen ("hostname")
local hostname = f:read("*a") or ""
f:close()
hostname = string.gsub(hostname, "\n$", "")
return hostname
end
return obj