Skip to content

Commit

Permalink
feat: added deprecated messages
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroSuero committed Jun 4, 2024
1 parent 9679488 commit e49fc7f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lua/freeze-code/deprecated.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
local deprecated = {}

deprecated.command = function(command, message)
local messages = {}
table.insert(
messages,
"Deprecated command: "
.. command
.. "\n"
.. message
.. ".\nPlease use :help freeze-code.nvim.txt for more information."
)
vim.api.nvim_err_write(
string.format("[freeze-code.nvim] %s", table.concat(messages, "\n \n ") .. "\n \nPress <Enter> to continue.\n")
)
end

deprecated.options = function(opts)
local messages = {}
table.insert(
messages,
"Deprecated options:\n" .. vim.inspect(opts) .. ".\nPlease use :help freeze-code.nvim.txt for more information."
)
vim.api.nvim_err_write(
string.format("[freeze-code.nvim] %s", table.concat(messages, "\n \n ") .. "\n \nPress <Enter> to continue.\n")
)
end

return deprecated
13 changes: 13 additions & 0 deletions lua/freeze-code/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

local api = require("freeze-code.utils.api")
local cfg = require("freeze-code.config")
local deprecate = require("freeze-code.deprecated")

---@class FreezeCode
local freeze_code = {}
Expand All @@ -21,6 +22,18 @@ local create_autocmds = function()
end, {})
end

---@class FreezeCode
---@field freeze function: freezes the current buffer
freeze_code.freeze = function(_line1, _line2)
deprecate.command("require('freeze-code').freeze", "Now using `require('freeze-code.utils.api').freeze`")
end

---@class FreezeCode
---@field freeze_line function: freezes the current line
freeze_code.freeze_line = function()
deprecate.command("require('freeze-code').freeze_line", "Now using `require('freeze-code.utils.api').freeze_line`")
end

---@class FreezeCode
---@field setup function: setup function for `freeze-code.nvim`
---freeze-code's set up function
Expand Down

0 comments on commit e49fc7f

Please sign in to comment.