2021-09-20 11:46:38 +00:00
|
|
|
-- Copyright (c) 2020-2021 shadmansaleh
|
|
|
|
-- MIT license, see LICENSE for more details.
|
2021-09-25 17:15:42 +00:00
|
|
|
local M = require('lualine.component'):extend()
|
2021-04-11 08:20:41 +00:00
|
|
|
|
2021-09-25 17:15:42 +00:00
|
|
|
M.update_status = function(self, is_focused)
|
2021-04-13 17:09:01 +00:00
|
|
|
-- 1st element in options table is the function provided by config
|
2021-09-03 12:19:00 +00:00
|
|
|
local ok, retval
|
|
|
|
ok, retval = pcall(self.options[1], self, is_focused)
|
2021-09-03 18:28:20 +00:00
|
|
|
if not ok then
|
|
|
|
return ''
|
|
|
|
end
|
2021-09-03 12:19:00 +00:00
|
|
|
if type(retval) ~= 'string' then
|
|
|
|
ok, retval = pcall(tostring, retval)
|
2021-09-03 18:28:20 +00:00
|
|
|
if not ok then
|
|
|
|
return ''
|
|
|
|
end
|
2021-09-03 12:19:00 +00:00
|
|
|
end
|
|
|
|
return retval
|
2021-04-11 08:20:41 +00:00
|
|
|
end
|
|
|
|
|
2021-09-25 17:15:42 +00:00
|
|
|
return M
|