Skip to content

Commit

Permalink
refactor: notify function
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Sep 22, 2023
1 parent 4371b37 commit 201c25c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lua/tinygit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ end
---send notification
---@param body string
---@param level? "info"|"trace"|"debug"|"warn"|"error"
local function notify(body, level, titleAppendix)
local pluginName = "tinygit"
---@param title? string
local function notify(body, level, title)
local titlePrefix = "tinygit"
if not level then level = "info" end
local title = titleAppendix and pluginName .. ": " .. titleAppendix or pluginName
vim.notify(vim.trim(body), vim.log.levels[level:upper()], { title = title })
local notifyTitle = title and titlePrefix .. ": " .. title or title
vim.notify(vim.trim(body), vim.log.levels[level:upper()], { title = notifyTitle })
end

---checks if last command was successful, if not, notify
Expand Down

0 comments on commit 201c25c

Please sign in to comment.