Skip to content

Commit e0a22a4

Browse files
committed
fix(commands): do not require preset name for enable_all and disable_all commands
1 parent 39b676e commit e0a22a4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/reactive/commands.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,16 @@ function M:init()
158158
return
159159
end
160160

161-
if not val then
161+
local is_preset_required = cmd == 'enable' or cmd == 'disable' or cmd == 'toggle'
162+
163+
if not val and is_preset_required then
162164
vim.notify('reactive.nvim: specify a preset name', vim.log.levels.ERROR)
163165
return
164166
end
165167

166168
if not self.commands[cmd] then
167169
vim.notify('reactive.nvim: There\'s no such a command: ' .. cmd, vim.log.levels.ERROR)
168-
elseif not require('reactive.state').presets[val] then
170+
elseif is_preset_required and not require('reactive.state').presets[val] then
169171
vim.notify('reactive.nvim: There\'s no such a preset: ' .. val, vim.log.levels.ERROR)
170172
else
171173
self.commands[cmd](val)

0 commit comments

Comments
 (0)