Skip to content

Commit f86ceaf

Browse files
committed
feat: New command to keep consistent with vim command style; Deprecate old command
1 parent 1d4a8f7 commit f86ceaf

File tree

5 files changed

+210
-1
lines changed

5 files changed

+210
-1
lines changed

lua/neominimap/command/buf.lua

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,75 @@ M.subcommand_tbl = {
55
["bufOn"] = {
66
impl = function(args)
77
local logger = require("neominimap.logger")
8+
local msg = vim.deprecate("bufOn", "BufEnable", "v4", "Neominimap")
9+
if msg then
10+
logger.notify(msg, vim.log.levels.WARN)
11+
end
812
logger.log.info("Command bufOn triggered.")
913
require("neominimap.api").buf.enable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
1014
end,
1115
},
1216
["bufOff"] = {
1317
impl = function(args)
1418
local logger = require("neominimap.logger")
19+
local msg = vim.deprecate("bufOff", "BufDisable", "v4", "Neominimap")
20+
if msg then
21+
logger.notify(msg, vim.log.levels.WARN)
22+
end
1523
logger.log.info("Command bufOff triggered.")
1624
require("neominimap.api").buf.disable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
1725
end,
1826
},
1927
["bufToggle"] = {
2028
impl = function(args)
2129
local logger = require("neominimap.logger")
30+
local msg = vim.deprecate("bufToggle", "BufToggle", "v4", "Neominimap")
31+
if msg then
32+
logger.notify(msg, vim.log.levels.WARN)
33+
end
2234
logger.log.info("Command bufToggle triggered.")
2335
require("neominimap.api").buf.toggle(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
2436
end,
2537
},
2638
["bufRefresh"] = {
2739
impl = function(args)
2840
local logger = require("neominimap.logger")
41+
local msg = vim.deprecate("bufRefresh", "BufRefresh", "v4", "Neominimap")
42+
if msg then
43+
logger.notify(msg, vim.log.levels.WARN)
44+
end
2945
logger.log.info("Command bufRefresh triggered.")
3046
require("neominimap.api").buf.refresh(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
3147
end,
3248
},
49+
["BufEnable"] = {
50+
impl = function(args)
51+
local logger = require("neominimap.logger")
52+
logger.log.info("Command BufEnable triggered.")
53+
require("neominimap.api").buf.enable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
54+
end,
55+
},
56+
["BufDisable"] = {
57+
impl = function(args)
58+
local logger = require("neominimap.logger")
59+
logger.log.info("Command BufDisable triggered.")
60+
require("neominimap.api").buf.disable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
61+
end,
62+
},
63+
["BufToggle"] = {
64+
impl = function(args)
65+
local logger = require("neominimap.logger")
66+
logger.log.info("Command BufToggle triggered.")
67+
require("neominimap.api").buf.toggle(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
68+
end,
69+
},
70+
["BufRefresh"] = {
71+
impl = function(args)
72+
local logger = require("neominimap.logger")
73+
logger.log.info("Command BufRefresh triggered.")
74+
require("neominimap.api").buf.refresh(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
75+
end,
76+
},
3377
}
3478

3579
return M

lua/neominimap/command/focus.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,57 @@ M.subcommand_tbl = {
55
["focus"] = {
66
impl = function()
77
local logger = require("neominimap.logger")
8+
local msg = vim.deprecate("focus", "Focus", "v4", "Neominimap")
9+
if msg then
10+
logger.notify(msg, vim.log.levels.WARN)
11+
end
812
logger.log.info("Command focus triggered.")
913
require("neominimap.api").focus.enable()
1014
end,
1115
},
1216
["unfocus"] = {
1317
impl = function()
1418
local logger = require("neominimap.logger")
19+
local msg = vim.deprecate("unfocus", "Unfocus", "v4", "Neominimap")
20+
if msg then
21+
logger.notify(msg, vim.log.levels.WARN)
22+
end
1523
logger.log.info("Command unfocus triggered.")
1624
require("neominimap.api").focus.disable()
1725
end,
1826
},
1927
["toggleFocus"] = {
2028
impl = function()
2129
local logger = require("neominimap.logger")
30+
local msg = vim.deprecate("toggleFocus", "ToggleFocus", "v4", "Neominimap")
31+
if msg then
32+
logger.notify(msg, vim.log.levels.WARN)
33+
end
2234
logger.log.info("Command toggleFocus triggered.")
2335
require("neominimap.api").focus.toggle()
2436
end,
2537
},
38+
["Focus"] = {
39+
impl = function()
40+
local logger = require("neominimap.logger")
41+
logger.log.info("Command Focus triggered.")
42+
require("neominimap.api").focus.enable()
43+
end,
44+
},
45+
["Unfocus"] = {
46+
impl = function()
47+
local logger = require("neominimap.logger")
48+
logger.log.info("Command Unfocus triggered.")
49+
require("neominimap.api").focus.disable()
50+
end,
51+
},
52+
["ToggleFocus"] = {
53+
impl = function()
54+
local logger = require("neominimap.logger")
55+
logger.log.info("Command ToggleFocus triggered.")
56+
require("neominimap.api").focus.toggle()
57+
end,
58+
},
2659
}
2760

2861
return M

lua/neominimap/command/global.lua

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,75 @@ M.subcommand_tbl = {
55
["on"] = {
66
impl = function()
77
local logger = require("neominimap.logger")
8+
local msg = vim.deprecate("on", "Enable", "v4", "Neominimap")
9+
if msg then
10+
logger.notify(msg, vim.log.levels.WARN)
11+
end
812
logger.log.info("Command on triggered.")
913
require("neominimap.api").enable()
1014
end,
1115
},
1216
["off"] = {
1317
impl = function()
1418
local logger = require("neominimap.logger")
19+
local msg = vim.deprecate("off", "Disable", "v4", "Neominimap")
20+
if msg then
21+
logger.notify(msg, vim.log.levels.WARN)
22+
end
1523
logger.log.info("Command off triggered.")
1624
require("neominimap.api").disable()
1725
end,
1826
},
1927
["toggle"] = {
2028
impl = function()
2129
local logger = require("neominimap.logger")
30+
local msg = vim.deprecate("toggle", "Toggle", "v4", "Neominimap")
31+
if msg then
32+
logger.notify(msg, vim.log.levels.WARN)
33+
end
2234
logger.log.info("Command toggle triggered.")
2335
require("neominimap.api").toggle()
2436
end,
2537
},
2638
["refresh"] = {
2739
impl = function()
2840
local logger = require("neominimap.logger")
41+
local msg = vim.deprecate("refresh", "Refresh", "v4", "Neominimap")
42+
if msg then
43+
logger.notify(msg, vim.log.levels.WARN)
44+
end
2945
logger.log.info("Command refresh triggered.")
3046
require("neominimap.api").refresh()
3147
end,
3248
},
49+
["Enable"] = {
50+
impl = function()
51+
local logger = require("neominimap.logger")
52+
logger.log.info("Command Enable triggered.")
53+
require("neominimap.api").enable()
54+
end,
55+
},
56+
["Disable"] = {
57+
impl = function()
58+
local logger = require("neominimap.logger")
59+
logger.log.info("Command Disable triggered.")
60+
require("neominimap.api").disable()
61+
end,
62+
},
63+
["Toggle"] = {
64+
impl = function()
65+
local logger = require("neominimap.logger")
66+
logger.log.info("Command Toggle triggered.")
67+
require("neominimap.api").toggle()
68+
end,
69+
},
70+
["Refresh"] = {
71+
impl = function()
72+
local logger = require("neominimap.logger")
73+
logger.log.info("Command Refresh triggered.")
74+
require("neominimap.api").refresh()
75+
end,
76+
},
3377
}
3478

3579
return M

lua/neominimap/command/tab.lua

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,79 @@
11
local M = {}
22

3-
---@type table<string, Neominimap.Subcommand>type table<Neominimap.Command.Tab, Neominimap.Subcommand>
3+
---@type table<string, Neominimap.Subcommand>
44
M.subcommand_tbl = {
55
["tabOn"] = {
66
impl = function(args)
77
local logger = require("neominimap.logger")
8+
local msg = vim.deprecate("tabOn", "TabEnable", "v4", "Neominimap")
9+
if msg then
10+
logger.notify(msg, vim.log.levels.WARN)
11+
end
812
logger.log.info("Command tabOn triggered.")
913
require("neominimap.api").tab.enable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
1014
end,
1115
},
1216
["tabOff"] = {
1317
impl = function(args)
1418
local logger = require("neominimap.logger")
19+
local msg = vim.deprecate("tabOff", "TabDisable", "v4", "Neominimap")
20+
if msg then
21+
logger.notify(msg, vim.log.levels.WARN)
22+
end
1523
logger.log.info("Command tabOff triggered.")
1624
require("neominimap.api").tab.disable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
1725
end,
1826
},
1927
["tabToggle"] = {
2028
impl = function(args)
2129
local logger = require("neominimap.logger")
30+
local msg = vim.deprecate("tabToggle", "TabToggle", "v4", "Neominimap")
31+
if msg then
32+
logger.notify(msg, vim.log.levels.WARN)
33+
end
2234
logger.log.info("Command tabToggle triggered.")
2335
require("neominimap.api").tab.toggle(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
2436
end,
2537
},
2638
["tabRefresh"] = {
2739
impl = function(args)
2840
local logger = require("neominimap.logger")
41+
local msg = vim.deprecate("tabRefresh", "TabRefresh", "v4", "Neominimap")
42+
if msg then
43+
logger.notify(msg, vim.log.levels.WARN)
44+
end
2945
logger.log.info("Command tabRefresh triggered.")
3046
require("neominimap.api").tab.refresh(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
3147
end,
3248
},
49+
["TabEnable"] = {
50+
impl = function(args)
51+
local logger = require("neominimap.logger")
52+
logger.log.info("Command TabEnable triggered.")
53+
require("neominimap.api").tab.enable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
54+
end,
55+
},
56+
["TabDisable"] = {
57+
impl = function(args)
58+
local logger = require("neominimap.logger")
59+
logger.log.info("Command TabDisable triggered.")
60+
require("neominimap.api").tab.disable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
61+
end,
62+
},
63+
["TabToggle"] = {
64+
impl = function(args)
65+
local logger = require("neominimap.logger")
66+
logger.log.info("Command TabToggle triggered.")
67+
require("neominimap.api").tab.toggle(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
68+
end,
69+
},
70+
["TabRefresh"] = {
71+
impl = function(args)
72+
local logger = require("neominimap.logger")
73+
logger.log.info("Command TabRefresh triggered.")
74+
require("neominimap.api").tab.refresh(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
75+
end,
76+
},
3377
}
3478

3579
return M

lua/neominimap/command/win.lua

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,75 @@ M.subcommand_tbl = {
55
["winOn"] = {
66
impl = function(args)
77
local logger = require("neominimap.logger")
8+
local msg = vim.deprecate("winOn", "WinEnable", "v4", "Neominimap")
9+
if msg then
10+
logger.notify(msg, vim.log.levels.WARN)
11+
end
812
logger.log.info("Command winOn triggered.")
913
require("neominimap.api").win.enable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
1014
end,
1115
},
1216
["winOff"] = {
1317
impl = function(args)
1418
local logger = require("neominimap.logger")
19+
local msg = vim.deprecate("winOff", "WinDisable", "v4", "Neominimap")
20+
if msg then
21+
logger.notify(msg, vim.log.levels.WARN)
22+
end
1523
logger.log.info("Command winOff triggered.")
1624
require("neominimap.api").win.disable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
1725
end,
1826
},
1927
["winToggle"] = {
2028
impl = function(args)
2129
local logger = require("neominimap.logger")
30+
local msg = vim.deprecate("winToggle", "WinToggle", "v4", "Neominimap")
31+
if msg then
32+
logger.notify(msg, vim.log.levels.WARN)
33+
end
2234
logger.log.info("Command winToggle triggered.")
2335
require("neominimap.api").win.toggle(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
2436
end,
2537
},
2638
["winRefresh"] = {
2739
impl = function(args)
2840
local logger = require("neominimap.logger")
41+
local msg = vim.deprecate("winRefresh", "WinRefresh", "v4", "Neominimap")
42+
if msg then
43+
logger.notify(msg, vim.log.levels.WARN)
44+
end
2945
logger.log.info("Command winRefresh triggered.")
3046
require("neominimap.api").win.refresh(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
3147
end,
3248
},
49+
["WinEnable"] = {
50+
impl = function(args)
51+
local logger = require("neominimap.logger")
52+
logger.log.info("Command WinEnable triggered.")
53+
require("neominimap.api").win.enable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
54+
end,
55+
},
56+
["WinDisable"] = {
57+
impl = function(args)
58+
local logger = require("neominimap.logger")
59+
logger.log.info("Command WinDisable triggered.")
60+
require("neominimap.api").win.disable(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
61+
end,
62+
},
63+
["WinToggle"] = {
64+
impl = function(args)
65+
local logger = require("neominimap.logger")
66+
logger.log.info("Command WinToggle triggered.")
67+
require("neominimap.api").win.toggle(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
68+
end,
69+
},
70+
["WinRefresh"] = {
71+
impl = function(args)
72+
local logger = require("neominimap.logger")
73+
logger.log.info("Command WinRefresh triggered.")
74+
require("neominimap.api").win.refresh(#args ~= 0 and vim.tbl_map(tonumber, args) or nil)
75+
end,
76+
},
3377
}
3478

3579
return M

0 commit comments

Comments
 (0)