feat: initial commit
This commit is contained in:
parent
b440657495
commit
e48a8f9c0c
10 changed files with 153 additions and 78 deletions
17
lua/http-codes/os.lua
Normal file
17
lua/http-codes/os.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
local OS_TO_OPEN_URL = {
|
||||
OSX = 'open %s',
|
||||
Windows = 'start %s',
|
||||
}
|
||||
|
||||
local function get_os()
|
||||
if jit then return jit.os end
|
||||
|
||||
local fh, _ = assert(io.popen('uname -o 2>/dev/null', 'r'))
|
||||
if fh then return fh:read() end
|
||||
|
||||
return fh and fh:read() or 'Windows'
|
||||
end
|
||||
|
||||
return {
|
||||
get_open_url = function() return OS_TO_OPEN_URL[get_os()] or 'xdg-open %s' end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue