Skip to content

Commit 3749f7a

Browse files
committed
feat: adds friendly error messages when action or preset is not specified after running Reactive command. ref: #19
1 parent 2bf4df3 commit 3749f7a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lua/reactive/commands.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,16 @@ function M:init()
153153
user_cmd('Reactive', function(opts)
154154
local cmd, val = unpack(vim.split(vim.trim(opts.args), '%s+'))
155155

156+
if not cmd or vim.trim(cmd) == '' then
157+
vim.notify('reactive.nvim: specify a command', vim.log.levels.ERROR)
158+
return
159+
end
160+
161+
if not val then
162+
vim.notify('reactive.nvim: specify a preset name', vim.log.levels.ERROR)
163+
return
164+
end
165+
156166
if not self.commands[cmd] then
157167
vim.notify('reactive.nvim: There\'s no such a command: ' .. cmd, vim.log.levels.ERROR)
158168
elseif not require('reactive.state').presets[val] then

0 commit comments

Comments
 (0)