diff --git a/lua/freeze-code/deprecated.lua b/lua/freeze-code/deprecated.lua new file mode 100644 index 0000000..959645b --- /dev/null +++ b/lua/freeze-code/deprecated.lua @@ -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 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 to continue.\n") + ) +end + +return deprecated diff --git a/lua/freeze-code/init.lua b/lua/freeze-code/init.lua index f30632f..b00d94f 100644 --- a/lua/freeze-code/init.lua +++ b/lua/freeze-code/init.lua @@ -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 = {} @@ -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