mirror of https://github.com/Hilbis/Hilbish
feat(ansikit): add link function
parent
6b065dc035
commit
85b347d5f3
|
@ -1,7 +1,7 @@
|
|||
-- We're basically porting Ansikit to lua
|
||||
-- https://github.com/Luvella/AnsiKit/blob/master/lib/index.js
|
||||
-- which is made by yours truly sammy :^)
|
||||
|
||||
local lunacolors = require 'lunacolors'
|
||||
local ansikit = {}
|
||||
|
||||
ansikit.clear = function(scrollback)
|
||||
|
@ -77,6 +77,12 @@ ansikit.hideCursor = function()
|
|||
return ansikit.printCSI('?25', 'l')
|
||||
end
|
||||
|
||||
ansikit.link = function(url, text)
|
||||
if not url then error 'ansikit: missing url for hyperlink' end
|
||||
local text = (text and text or 'link')
|
||||
io.write(lunacolors.blue('\27]8;;' .. url .. '\27\\' .. text .. '\27]8;;\27\\\n'))
|
||||
end
|
||||
|
||||
ansikit.print = function(text)
|
||||
io.write(ansikit.format(text))
|
||||
return ansikit
|
||||
|
|
Loading…
Reference in New Issue