Skip to content

Commit

Permalink
fix(commands): do not require preset name for enable_all and `disab…
Browse files Browse the repository at this point in the history
…le_all` commands
  • Loading branch information
rasulomaroff committed Jan 8, 2025
1 parent 39b676e commit e0a22a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/reactive/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,16 @@ function M:init()
return
end

if not val then
local is_preset_required = cmd == 'enable' or cmd == 'disable' or cmd == 'toggle'

if not val and is_preset_required then
vim.notify('reactive.nvim: specify a preset name', vim.log.levels.ERROR)
return
end

if not self.commands[cmd] then
vim.notify('reactive.nvim: There\'s no such a command: ' .. cmd, vim.log.levels.ERROR)
elseif not require('reactive.state').presets[val] then
elseif is_preset_required and not require('reactive.state').presets[val] then
vim.notify('reactive.nvim: There\'s no such a preset: ' .. val, vim.log.levels.ERROR)
else
self.commands[cmd](val)
Expand Down

0 comments on commit e0a22a4

Please sign in to comment.