mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 13:46:41 +00:00
Add env module
This commit is contained in:
17
hammerspoon/env.lua
Normal file
17
hammerspoon/env.lua
Normal 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
|
||||
Reference in New Issue
Block a user