Skip to content

Commit

Permalink
feat: adds friendly error messages when action or preset is not speci…
Browse files Browse the repository at this point in the history
…fied after running `Reactive` command. ref: #19
  • Loading branch information
rasulomaroff committed Jan 8, 2025
1 parent 2bf4df3 commit 3749f7a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lua/reactive/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ function M:init()
user_cmd('Reactive', function(opts)
local cmd, val = unpack(vim.split(vim.trim(opts.args), '%s+'))

if not cmd or vim.trim(cmd) == '' then
vim.notify('reactive.nvim: specify a command', vim.log.levels.ERROR)
return
end

if not val 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
Expand Down

0 comments on commit 3749f7a

Please sign in to comment.